SOLR-7041: Cut over tests from <defaultSearchField> in schema to df on requests

This commit is contained in:
Jan Høydahl 2017-05-05 00:53:50 +02:00
parent de709b122d
commit e776cbe446
104 changed files with 158 additions and 214 deletions

View File

@ -335,6 +335,8 @@ Other Changes
* SOLR-9867: Adding isLoading=true as core status. Fixing start after stop scenario in bin/solr * SOLR-9867: Adding isLoading=true as core status. Fixing start after stop scenario in bin/solr
(Andrey Kudryavtsev, Mikhail Khludnev) (Andrey Kudryavtsev, Mikhail Khludnev)
* SOLR-7041: Cutover tests to using 'q.op' and 'df' instead of schema 'defaultOperator' and 'defaultSearchField' (janhoy)
================== 6.5.1 ================== ================== 6.5.1 ==================
Bug Fixes Bug Fixes

View File

@ -47,7 +47,6 @@
<field name="content_icutransform" type="text_icutransform" indexed="true" stored="true"/> <field name="content_icutransform" type="text_icutransform" indexed="true" stored="true"/>
<defaultSearchField>id</defaultSearchField>
<uniqueKey>id</uniqueKey> <uniqueKey>id</uniqueKey>
</schema> </schema>

View File

@ -46,7 +46,6 @@
<field name="sort_da" type="sort_da_t" indexed="false" stored="false" multiValued="false" docValues="true"/> <field name="sort_da" type="sort_da_t" indexed="false" stored="false" multiValued="false" docValues="true"/>
<field name="sort_custom" type="sort_custom_t" indexed="false" stored="false" multiValued="true" docValues="true"/> <field name="sort_custom" type="sort_custom_t" indexed="false" stored="false" multiValued="true" docValues="true"/>
<defaultSearchField>text</defaultSearchField>
<uniqueKey>id</uniqueKey> <uniqueKey>id</uniqueKey>
<!-- copy our text to some sort fields with different orders --> <!-- copy our text to some sort fields with different orders -->

View File

@ -46,7 +46,6 @@
<field name="sort_custom" type="sort_custom_t" indexed="true" stored="false" multiValued="false"/> <field name="sort_custom" type="sort_custom_t" indexed="true" stored="false" multiValued="false"/>
<defaultSearchField>text</defaultSearchField>
<uniqueKey>id</uniqueKey> <uniqueKey>id</uniqueKey>
<!-- copy our text to some sort fields with different orders --> <!-- copy our text to some sort fields with different orders -->

View File

@ -57,7 +57,6 @@
<field name="sort_uppercase_first" type="sort_uppercase_first_t" indexed="true" stored="false" multiValued="false"/> <field name="sort_uppercase_first" type="sort_uppercase_first_t" indexed="true" stored="false" multiValued="false"/>
<defaultSearchField>text</defaultSearchField>
<uniqueKey>id</uniqueKey> <uniqueKey>id</uniqueKey>
<!-- copy our text to some sort fields with different orders --> <!-- copy our text to some sort fields with different orders -->

View File

@ -334,9 +334,6 @@
--> -->
<uniqueKey>id</uniqueKey> <uniqueKey>id</uniqueKey>
<!-- field for the QueryParser to use when an explicit fieldname is absent -->
<defaultSearchField>text</defaultSearchField>
<!-- copyField commands copy one field to another at the time a document <!-- copyField commands copy one field to another at the time a document
is added to the index. It's used either to index the same field differently, is added to the index. It's used either to index the same field differently,
or to add multiple fields to the same field for easier/faster searching. --> or to add multiple fields to the same field for easier/faster searching. -->

View File

@ -202,7 +202,4 @@
<field name="text" type="text" indexed="true" stored="true"/> <field name="text" type="text" indexed="true" stored="true"/>
<field name="foo_i" type="int" indexed="true" stored="false"/> <field name="foo_i" type="int" indexed="true" stored="false"/>
<field name="home" type="latLon" indexed="true" stored="true"/> <field name="home" type="latLon" indexed="true" stored="true"/>
<!-- field for the QueryParser to use when an explicit fieldname is absent -->
<defaultSearchField>text</defaultSearchField>
</schema> </schema>

View File

@ -67,5 +67,4 @@
<dynamicField name="*_dt" type="date" indexed="true" stored="true"/> <dynamicField name="*_dt" type="date" indexed="true" stored="true"/>
<uniqueKey>id</uniqueKey> <uniqueKey>id</uniqueKey>
<defaultSearchField>desc</defaultSearchField>
</schema> </schema>

View File

@ -310,7 +310,4 @@
Unless this field is marked with required="false", it will be a required field Unless this field is marked with required="false", it will be a required field
--> -->
<uniqueKey>solr_id</uniqueKey> <uniqueKey>solr_id</uniqueKey>
<!-- field for the QueryParser to use when an explicit fieldname is absent -->
<defaultSearchField>desc</defaultSearchField>
</schema> </schema>

View File

@ -232,6 +232,7 @@
<!-- default values for query parameters --> <!-- default values for query parameters -->
<lst name="defaults"> <lst name="defaults">
<str name="echoParams">explicit</str> <str name="echoParams">explicit</str>
<str name="df">desc</str>
<!-- <!--
<int name="rows">10</int> <int name="rows">10</int>
<str name="fl">*</str> <str name="fl">*</str>

View File

@ -92,7 +92,7 @@ public class TestContentStreamDataSource extends AbstractDataImportHandlerTestCa
try (HttpSolrClient solrServer = getHttpSolrClient(buildUrl(jetty.getLocalPort(), "/solr/collection1"))) { try (HttpSolrClient solrServer = getHttpSolrClient(buildUrl(jetty.getLocalPort(), "/solr/collection1"))) {
solrServer.request(req); solrServer.request(req);
Thread.sleep(100); Thread.sleep(100);
ModifiableSolrParams queryAll = params("q", "*"); ModifiableSolrParams queryAll = params("q", "*", "df", "desc");
QueryResponse qres = solrServer.query(queryAll); QueryResponse qres = solrServer.query(queryAll);
SolrDocumentList results = qres.getResults(); SolrDocumentList results = qres.getResults();
assertEquals(0, results.getNumFound()); assertEquals(0, results.getNumFound());

View File

@ -478,7 +478,6 @@
<dynamicField name="ignored_*" type="text" indexed="false" stored="false"/> <dynamicField name="ignored_*" type="text" indexed="false" stored="false"/>
<defaultSearchField>text</defaultSearchField>
<uniqueKey>id</uniqueKey> <uniqueKey>id</uniqueKey>
<!-- copyField commands copy one field to another at the time a document <!-- copyField commands copy one field to another at the time a document

View File

@ -218,7 +218,7 @@ public class TestXLSXResponseWriter extends SolrTestCaseJ4 {
assertEquals("1,0,hi", lines[1] ); assertEquals("1,0,hi", lines[1] );
//assertions specific to multiple pseudofields functions like abs, div, exists, etc.. (SOLR-5423) //assertions specific to multiple pseudofields functions like abs, div, exists, etc.. (SOLR-5423)
String funcText = getStringFromSheet(getWSResultForQuery(req("q","*", "wt","xlsx", "fl","XXX:id,YYY:exists(foo_s1)"))); String funcText = getStringFromSheet(getWSResultForQuery(req("df", "text", "q","*", "wt","xlsx", "fl","XXX:id,YYY:exists(foo_s1)")));
String[] funcLines = funcText.split("\n"); String[] funcLines = funcText.split("\n");
assertEquals(5, funcLines.length); assertEquals(5, funcLines.length);
assertEquals("XXX,YYY", funcLines[0] ); assertEquals("XXX,YYY", funcLines[0] );

View File

@ -68,7 +68,6 @@
<dynamicField name="subject_*" type="string" indexed="true" stored="false"/> <dynamicField name="subject_*" type="string" indexed="true" stored="false"/>
<defaultSearchField>name</defaultSearchField>
<uniqueKey>id</uniqueKey> <uniqueKey>id</uniqueKey>

View File

@ -578,12 +578,6 @@
--> -->
<uniqueKey>id</uniqueKey> <uniqueKey>id</uniqueKey>
<!--
field for the QueryParser to use when an explicit fieldname is
absent
-->
<defaultSearchField>text</defaultSearchField>
<!-- <!--
copyField commands copy one field to another at the time a document copyField commands copy one field to another at the time a document
is added to the index. It's used either to index the same field is added to the index. It's used either to index the same field

View File

@ -576,12 +576,6 @@
--> -->
<uniqueKey>id</uniqueKey> <uniqueKey>id</uniqueKey>
<!--
field for the QueryParser to use when an explicit fieldname is
absent
-->
<defaultSearchField>text</defaultSearchField>
<!-- <!--
copyField commands copy one field to another at the time a document copyField commands copy one field to another at the time a document
is added to the index. It's used either to index the same field is added to the index. It's used either to index the same field

View File

@ -23,6 +23,4 @@
<dynamicField name="*_s" type="string" indexed="true" stored="true"/> <dynamicField name="*_s" type="string" indexed="true" stored="true"/>
<uniqueKey>id</uniqueKey> <uniqueKey>id</uniqueKey>
<defaultSearchField>id</defaultSearchField>
</schema> </schema>

View File

@ -36,6 +36,5 @@
<field name="text" type="text" indexed="true" stored="true"/> <field name="text" type="text" indexed="true" stored="true"/>
<field name="_version_" type="long"/> <field name="_version_" type="long"/>
<defaultSearchField>text</defaultSearchField>
<uniqueKey>id</uniqueKey> <uniqueKey>id</uniqueKey>
</schema> </schema>

View File

@ -37,7 +37,6 @@ Test for HighlighterMaxOffsetTest which requires the use of ReversedWildcardFilt
<uniqueKey>id</uniqueKey> <uniqueKey>id</uniqueKey>
<defaultSearchField>content</defaultSearchField>
<fieldType name="string" class="solr.StrField" sortMissingLast="true"/> <fieldType name="string" class="solr.StrField" sortMissingLast="true"/>

View File

@ -36,6 +36,5 @@
<dynamicField name="*_f_multi" type="float" indexed="true" stored="true" docValues="true" multiValued="true"/> <dynamicField name="*_f_multi" type="float" indexed="true" stored="true" docValues="true" multiValued="true"/>
<defaultSearchField>name</defaultSearchField>
<uniqueKey>id</uniqueKey> <uniqueKey>id</uniqueKey>
</schema> </schema>

View File

@ -41,7 +41,6 @@
<field name="text" type="text" indexed="true" stored="false"/> <field name="text" type="text" indexed="true" stored="false"/>
<field name="text_params" type="text_params" indexed="true" stored="false"/> <field name="text_params" type="text_params" indexed="true" stored="false"/>
<defaultSearchField>text</defaultSearchField>
<uniqueKey>id</uniqueKey> <uniqueKey>id</uniqueKey>
</schema> </schema>

View File

@ -42,7 +42,6 @@
<field name="content" type="text" indexed="true" stored="true"/> <field name="content" type="text" indexed="true" stored="true"/>
<field name="content2" type="text2" indexed="true" stored="true"/> <field name="content2" type="text2" indexed="true" stored="true"/>
<defaultSearchField>content</defaultSearchField>
<uniqueKey>id</uniqueKey> <uniqueKey>id</uniqueKey>
</schema> </schema>

View File

@ -47,7 +47,6 @@
<field name="sort_da" type="sort_da_t" indexed="false" stored="false" multiValued="false" docValues="true"/> <field name="sort_da" type="sort_da_t" indexed="false" stored="false" multiValued="false" docValues="true"/>
<field name="sort_custom" type="sort_custom_t" indexed="false" stored="false" multiValued="true" docValues="true"/> <field name="sort_custom" type="sort_custom_t" indexed="false" stored="false" multiValued="true" docValues="true"/>
<defaultSearchField>text</defaultSearchField>
<uniqueKey>id</uniqueKey> <uniqueKey>id</uniqueKey>
<!-- copy our text to some sort fields with different orders --> <!-- copy our text to some sort fields with different orders -->

View File

@ -46,7 +46,6 @@
<field name="sort_da" type="sort_da_t" indexed="true" stored="false" multiValued="false"/> <field name="sort_da" type="sort_da_t" indexed="true" stored="false" multiValued="false"/>
<field name="sort_custom" type="sort_custom_t" indexed="true" stored="false" multiValued="false"/> <field name="sort_custom" type="sort_custom_t" indexed="true" stored="false" multiValued="false"/>
<defaultSearchField>text</defaultSearchField>
<uniqueKey>id</uniqueKey> <uniqueKey>id</uniqueKey>
<!-- copy our text to some sort fields with different orders --> <!-- copy our text to some sort fields with different orders -->

View File

@ -462,7 +462,6 @@
termVectors="true" termPositions="true" termOffsets="true"/> termVectors="true" termPositions="true" termOffsets="true"/>
<defaultSearchField>text</defaultSearchField>
<uniqueKey>id</uniqueKey> <uniqueKey>id</uniqueKey>
<!-- copyField commands copy one field to another at the time a document <!-- copyField commands copy one field to another at the time a document

View File

@ -36,6 +36,5 @@
<!-- catchall wildcard to help ensure we aren't breaking function sorting --> <!-- catchall wildcard to help ensure we aren't breaking function sorting -->
<dynamicField name="*" type="string" indexed="true" stored="true"/> <dynamicField name="*" type="string" indexed="true" stored="true"/>
<defaultSearchField>text</defaultSearchField>
<uniqueKey>id</uniqueKey> <uniqueKey>id</uniqueKey>
</schema> </schema>

View File

@ -43,7 +43,6 @@
<field name="text" type="text" indexed="true" stored="false"/> <field name="text" type="text" indexed="true" stored="false"/>
<field name="text_params" type="text_params" indexed="true" stored="false"/> <field name="text_params" type="text_params" indexed="true" stored="false"/>
<defaultSearchField>text</defaultSearchField>
<uniqueKey>id</uniqueKey> <uniqueKey>id</uniqueKey>
<similarity class="solr.SchemaSimilarityFactory"/> <similarity class="solr.SchemaSimilarityFactory"/>

View File

@ -59,7 +59,6 @@
<field name="text_params" type="text_params" indexed="true" stored="false"/> <field name="text_params" type="text_params" indexed="true" stored="false"/>
<field name="text_paramc" type="text_paramc" indexed="true" stored="false"/> <field name="text_paramc" type="text_paramc" indexed="true" stored="false"/>
<defaultSearchField>text</defaultSearchField>
<uniqueKey>id</uniqueKey> <uniqueKey>id</uniqueKey>
</schema> </schema>

View File

@ -73,7 +73,6 @@
<dynamicField name="*_d1" type="double" indexed="true" stored="true" multiValued="false"/> <dynamicField name="*_d1" type="double" indexed="true" stored="true" multiValued="false"/>
<dynamicField name="*_dt1" type="date" indexed="true" stored="true" multiValued="false"/> <dynamicField name="*_dt1" type="date" indexed="true" stored="true" multiValued="false"/>
<defaultSearchField>id</defaultSearchField>
<uniqueKey>id</uniqueKey> <uniqueKey>id</uniqueKey>
<copyField source="*_i" dest="*_i_dv"/> <copyField source="*_i" dest="*_i_dv"/>

View File

@ -64,7 +64,6 @@
<dynamicField name="*_dt_dv" type="${solr.tests.dateClass:pdate}" indexed="true" stored="false" docValues="true"/> <dynamicField name="*_dt_dv" type="${solr.tests.dateClass:pdate}" indexed="true" stored="false" docValues="true"/>
<dynamicField name="*_dts_dv" type="${solr.tests.dateClass:pdate}" indexed="true" stored="false" docValues="true" multiValued="true"/> <dynamicField name="*_dts_dv" type="${solr.tests.dateClass:pdate}" indexed="true" stored="false" docValues="true" multiValued="true"/>
<defaultSearchField>id</defaultSearchField>
<uniqueKey>id</uniqueKey> <uniqueKey>id</uniqueKey>
<copyField source="*_i" dest="*_i_dv"/> <copyField source="*_i" dest="*_i_dv"/>

View File

@ -93,7 +93,6 @@
<field name="_version_" type="long" indexed="true" stored="true" multiValued="false"/> <field name="_version_" type="long" indexed="true" stored="true" multiValued="false"/>
<defaultSearchField>id</defaultSearchField>
<uniqueKey>id</uniqueKey> <uniqueKey>id</uniqueKey>
<copyField source="*_i" dest="*_i_dv"/> <copyField source="*_i" dest="*_i_dv"/>

View File

@ -32,6 +32,5 @@
<field name="payload" type="wrapped_int" indexed="false" <field name="payload" type="wrapped_int" indexed="false"
stored="true" multiValued="false" docValues="true" required="true"/> stored="true" multiValued="false" docValues="true" required="true"/>
<defaultSearchField>text</defaultSearchField>
<uniqueKey>id</uniqueKey> <uniqueKey>id</uniqueKey>
</schema> </schema>

View File

@ -256,7 +256,6 @@
<dynamicField name="*_fr" type="text_fr" indexed="true" stored="true"/> <dynamicField name="*_fr" type="text_fr" indexed="true" stored="true"/>
<defaultSearchField>content</defaultSearchField>
<uniqueKey>id</uniqueKey> <uniqueKey>id</uniqueKey>
</schema> </schema>

View File

@ -609,7 +609,6 @@
<dynamicField name="*_sim3" type="sim3" indexed="true" stored="true"/> <dynamicField name="*_sim3" type="sim3" indexed="true" stored="true"/>
--> -->
<defaultSearchField>text</defaultSearchField>
<uniqueKey>id</uniqueKey> <uniqueKey>id</uniqueKey>
<!-- copyField commands copy one field to another at the time a document <!-- copyField commands copy one field to another at the time a document

View File

@ -46,7 +46,6 @@
<field name="text" type="text" indexed="true" stored="false"/> <field name="text" type="text" indexed="true" stored="false"/>
<field name="text_params" type="text_params" indexed="true" stored="false"/> <field name="text_params" type="text_params" indexed="true" stored="false"/>
<defaultSearchField>text</defaultSearchField>
<uniqueKey>id</uniqueKey> <uniqueKey>id</uniqueKey>
</schema> </schema>

View File

@ -39,7 +39,6 @@
<field name="text" type="text" indexed="true" stored="false"/> <field name="text" type="text" indexed="true" stored="false"/>
<field name="text_params" type="text_params" indexed="true" stored="false"/> <field name="text_params" type="text_params" indexed="true" stored="false"/>
<defaultSearchField>text</defaultSearchField>
<uniqueKey>id</uniqueKey> <uniqueKey>id</uniqueKey>
</schema> </schema>

View File

@ -39,7 +39,6 @@
<field name="text" type="text" indexed="true" stored="false"/> <field name="text" type="text" indexed="true" stored="false"/>
<field name="text_params" type="text_params" indexed="true" stored="false"/> <field name="text_params" type="text_params" indexed="true" stored="false"/>
<defaultSearchField>text</defaultSearchField>
<uniqueKey>id</uniqueKey> <uniqueKey>id</uniqueKey>
</schema> </schema>

View File

@ -36,6 +36,5 @@
<field name="signatureField" type="string" indexed="true" stored="false"/> <field name="signatureField" type="string" indexed="true" stored="false"/>
<dynamicField name="*_sS" type="string" indexed="false" stored="true"/> <dynamicField name="*_sS" type="string" indexed="false" stored="true"/>
<defaultSearchField>subject</defaultSearchField>
<uniqueKey>id</uniqueKey> <uniqueKey>id</uniqueKey>
</schema> </schema>

View File

@ -52,6 +52,5 @@
<field name="text" type="text" indexed="true" stored="false"/> <field name="text" type="text" indexed="true" stored="false"/>
<field name="stext" type="text" indexed="true" stored="true"/> <field name="stext" type="text" indexed="true" stored="true"/>
<defaultSearchField>text</defaultSearchField>
<uniqueKey>id</uniqueKey> <uniqueKey>id</uniqueKey>
</schema> </schema>

View File

@ -42,6 +42,5 @@
<field name="text2" type="text" indexed="true" stored="true"/> <field name="text2" type="text" indexed="true" stored="true"/>
<field name="text3" type="text_offsets" indexed="true" stored="true"/> <field name="text3" type="text_offsets" indexed="true" stored="true"/>
<defaultSearchField>text</defaultSearchField>
<uniqueKey>id</uniqueKey> <uniqueKey>id</uniqueKey>
</schema> </schema>

View File

@ -35,7 +35,6 @@
<dynamicField name="*" type="string" indexed="true" stored="true" /> <dynamicField name="*" type="string" indexed="true" stored="true" />
<uniqueKey>id</uniqueKey> <uniqueKey>id</uniqueKey>
<defaultSearchField>text</defaultSearchField>
<fieldType name="ignored" class="solr.StrField" indexed="false" stored="false"/> <fieldType name="ignored" class="solr.StrField" indexed="false" stored="false"/>
<fieldType name="int" class="solr.TrieIntField" precisionStep="0" omitNorms="true" positionIncrementGap="0"/> <fieldType name="int" class="solr.TrieIntField" precisionStep="0" omitNorms="true" positionIncrementGap="0"/>

View File

@ -426,7 +426,6 @@
<dynamicField name="*aaa" type="int" indexed="false" stored="true"/> <dynamicField name="*aaa" type="int" indexed="false" stored="true"/>
<defaultSearchField>text</defaultSearchField>
<uniqueKey>id</uniqueKey> <uniqueKey>id</uniqueKey>
<!-- copyField commands copy one field to another at the time a document <!-- copyField commands copy one field to another at the time a document

View File

@ -657,7 +657,6 @@
<dynamicField name="random_*" type="random"/> <dynamicField name="random_*" type="random"/>
<defaultSearchField>text</defaultSearchField>
<uniqueKey>id</uniqueKey> <uniqueKey>id</uniqueKey>
<copyField source="title" dest="title_stemmed" maxChars="200"/> <copyField source="title" dest="title_stemmed" maxChars="200"/>

View File

@ -77,7 +77,6 @@
<dynamicField name="*_sS" type="string" indexed="false" stored="true"/> <dynamicField name="*_sS" type="string" indexed="false" stored="true"/>
<defaultSearchField>one</defaultSearchField>
<uniqueKey>id</uniqueKey> <uniqueKey>id</uniqueKey>

View File

@ -56,7 +56,6 @@
<dynamicField name="*_sim2" type="sim2" indexed="true" stored="true"/> <dynamicField name="*_sim2" type="sim2" indexed="true" stored="true"/>
<dynamicField name="*_sim3" type="sim3" indexed="true" stored="true"/> <dynamicField name="*_sim3" type="sim3" indexed="true" stored="true"/>
<defaultSearchField>sim1text</defaultSearchField>
<uniqueKey>id</uniqueKey> <uniqueKey>id</uniqueKey>
<!-- Global similarity, defers to the fieldType. <!-- Global similarity, defers to the fieldType.

View File

@ -56,6 +56,5 @@
<field name="text-keyword0" type="text-keyword" indexed="true" stored="true"/> <field name="text-keyword0" type="text-keyword" indexed="true" stored="true"/>
<field name="text-query0" type="text-query" indexed="true" stored="true"/> <field name="text-query0" type="text-query" indexed="true" stored="true"/>
<defaultSearchField>text0</defaultSearchField>
<uniqueKey>id</uniqueKey> <uniqueKey>id</uniqueKey>
</schema> </schema>

View File

@ -657,7 +657,6 @@
<dynamicField name="random_*" type="random"/> <dynamicField name="random_*" type="random"/>
<defaultSearchField>text</defaultSearchField>
<uniqueKey>id</uniqueKey> <uniqueKey>id</uniqueKey>
<copyField source="*" dest="text"/> <copyField source="*" dest="text"/>

View File

@ -71,7 +71,4 @@
<!-- field to use to determine and enforce document uniqueness. --> <!-- field to use to determine and enforce document uniqueness. -->
<uniqueKey>id</uniqueKey> <uniqueKey>id</uniqueKey>
<!-- field for the QueryParser to use when an explicit fieldname is absent -->
<defaultSearchField>text</defaultSearchField>
</schema> </schema>

View File

@ -616,7 +616,6 @@
<dynamicField name="*_sim3" type="sim3" indexed="true" stored="true"/> <dynamicField name="*_sim3" type="sim3" indexed="true" stored="true"/>
--> -->
<defaultSearchField>text</defaultSearchField>
<uniqueKey>id</uniqueKey> <uniqueKey>id</uniqueKey>
<!-- copyField commands copy one field to another at the time a document <!-- copyField commands copy one field to another at the time a document

View File

@ -1,59 +0,0 @@
<?xml version="1.0" ?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!--
For testing stopword configuration and keep word configuration
-->
<schema name="test" version="1.0">
<fieldType name="integer" class="solr.TrieIntField" precisionStep="0"/>
<fieldType name="string" class="solr.StrField" sortMissingLast="true"/>
<fieldType name="stop-one" class="solr.TextField">
<analyzer>
<tokenizer class="solr.MockTokenizerFactory"/>
<filter class="solr.LowerCaseFilterFactory"/>
<filter class="solr.StopFilterFactory" ignoreCase="true"
words="stop-1.txt"/>
</analyzer>
</fieldType>
<fieldType name="stop-two" class="solr.TextField">
<analyzer>
<tokenizer class="solr.MockTokenizerFactory"/>
<filter class="solr.LowerCaseFilterFactory"/>
<filter class="solr.StopFilterFactory" ignoreCase="true"
words="stop-1.txt,stop-2.txt"/>
</analyzer>
</fieldType>
<field name="id" type="integer" indexed="true" stored="true" multiValued="false" required="false"/>
<field name="one" type="stop-one" indexed="true" stored="false"/>
<field name="two" type="stop-two" indexed="true" stored="false"/>
<defaultSearchField>one</defaultSearchField>
<uniqueKey>id</uniqueKey>
</schema>

View File

@ -64,7 +64,6 @@
<field name="text_baseline" type="text_baseline"/> <field name="text_baseline" type="text_baseline"/>
<field name="text_hyperbolic" type="text_hyperbolic"/> <field name="text_hyperbolic" type="text_hyperbolic"/>
<defaultSearchField>text</defaultSearchField>
<uniqueKey>id</uniqueKey> <uniqueKey>id</uniqueKey>
</schema> </schema>

View File

@ -36,6 +36,5 @@
<field name="id" type="int" indexed="true" stored="true" multiValued="false" required="false"/> <field name="id" type="int" indexed="true" stored="true" multiValued="false" required="false"/>
<field name="text" type="text_synonyms" indexed="true" stored="false"/> <field name="text" type="text_synonyms" indexed="true" stored="false"/>
<defaultSearchField>text</defaultSearchField>
<uniqueKey>id</uniqueKey> <uniqueKey>id</uniqueKey>
</schema> </schema>

View File

@ -40,6 +40,5 @@
<field name="id" type="int" indexed="true" stored="true" multiValued="false" required="false"/> <field name="id" type="int" indexed="true" stored="true" multiValued="false" required="false"/>
<fieldType name="int" class="solr.TrieIntField" precisionStep="0" omitNorms="true" positionIncrementGap="0"/> <fieldType name="int" class="solr.TrieIntField" precisionStep="0" omitNorms="true" positionIncrementGap="0"/>
<defaultSearchField>text</defaultSearchField>
<uniqueKey>id</uniqueKey> <uniqueKey>id</uniqueKey>
</schema> </schema>

View File

@ -323,8 +323,4 @@
Unless this field is marked with required="false", it will be a required field Unless this field is marked with required="false", it will be a required field
--> -->
<uniqueKey>id</uniqueKey> <uniqueKey>id</uniqueKey>
<!-- field for the QueryParser to use when an explicit fieldname is absent -->
<defaultSearchField>text</defaultSearchField>
</schema> </schema>

View File

@ -41,6 +41,5 @@
<field name="text2" type="text" indexed="true" stored="true"/> <field name="text2" type="text" indexed="true" stored="true"/>
<field name="text3" type="text_offsets" indexed="true" stored="true" large="true"/> <field name="text3" type="text_offsets" indexed="true" stored="true" large="true"/>
<defaultSearchField>text</defaultSearchField>
<uniqueKey>id</uniqueKey> <uniqueKey>id</uniqueKey>
</schema> </schema>

View File

@ -773,7 +773,6 @@
<copyField source="single_d_dvn" dest="copy_single_d_dvn"/> <copyField source="single_d_dvn" dest="copy_single_d_dvn"/>
<copyField source="single_s_dvn" dest="copy_single_s_dvn"/> <copyField source="single_s_dvn" dest="copy_single_s_dvn"/>
<defaultSearchField>text</defaultSearchField>
<uniqueKey>id</uniqueKey> <uniqueKey>id</uniqueKey>
<!-- copyField commands copy one field to another at the time a document <!-- copyField commands copy one field to another at the time a document

View File

@ -486,8 +486,4 @@ valued. -->
Unless this field is marked with required="false", it will be a required field Unless this field is marked with required="false", it will be a required field
--> -->
<uniqueKey>id</uniqueKey> <uniqueKey>id</uniqueKey>
<!-- field for the QueryParser to use when an explicit fieldname is absent -->
<defaultSearchField>text</defaultSearchField>
</schema> </schema>

View File

@ -641,7 +641,6 @@
<dynamicField name="*core" type="ignored" multiValued="true"/> <dynamicField name="*core" type="ignored" multiValued="true"/>
<defaultSearchField>text</defaultSearchField>
<uniqueKey>id</uniqueKey> <uniqueKey>id</uniqueKey>
<copyField source="title" dest="title_stemmed"/> <copyField source="title" dest="title_stemmed"/>

View File

@ -627,7 +627,6 @@
</fieldType> </fieldType>
<defaultSearchField>text</defaultSearchField>
<uniqueKey>id</uniqueKey> <uniqueKey>id</uniqueKey>
<copyField source="title" dest="title_stemmed"/> <copyField source="title" dest="title_stemmed"/>

View File

@ -50,6 +50,5 @@
<dynamicField name="*_disk" type="string_disk" indexed="false" stored="false" docValues="true"/> <dynamicField name="*_disk" type="string_disk" indexed="false" stored="false" docValues="true"/>
<dynamicField name="*_memory" type="string_memory" indexed="false" stored="false" docValues="true"/> <dynamicField name="*_memory" type="string_memory" indexed="false" stored="false" docValues="true"/>
<defaultSearchField>string_f</defaultSearchField>
<uniqueKey>string_f</uniqueKey> <uniqueKey>string_f</uniqueKey>
</schema> </schema>

View File

@ -615,7 +615,6 @@
<dynamicField name="random_*" type="random"/> <dynamicField name="random_*" type="random"/>
<defaultSearchField>text</defaultSearchField>
<uniqueKey>id</uniqueKey> <uniqueKey>id</uniqueKey>
<copyField source="title" dest="title_stemmed"/> <copyField source="title" dest="title_stemmed"/>

View File

@ -74,6 +74,12 @@
</query> </query>
<initParams path="standard">
<lst name="defaults">
<str name="df">text</str>
</lst>
</initParams>
</config> </config>

View File

@ -448,5 +448,10 @@ based HashBitset. -->
<processor class="solr.RunUpdateProcessorFactory" /> <processor class="solr.RunUpdateProcessorFactory" />
</updateRequestProcessorChain> </updateRequestProcessorChain>
<initParams path="/elevate,standard">
<lst name="defaults">
<str name="df">text</str>
</lst>
</initParams>
</config> </config>

View File

@ -169,4 +169,10 @@
<queryParser name="foo" class="FooQParserPlugin"/> <queryParser name="foo" class="FooQParserPlugin"/>
<initParams path="/elevate,/dataElevate">
<lst name="defaults">
<str name="df">text</str>
</lst>
</initParams>
</config> </config>

View File

@ -39,5 +39,10 @@
<valueSourceParser name="nvl" class="org.apache.solr.search.function.NvlValueSourceParser"> <valueSourceParser name="nvl" class="org.apache.solr.search.function.NvlValueSourceParser">
<float name="nvlFloatValue">0.0</float> <float name="nvlFloatValue">0.0</float>
</valueSourceParser> </valueSourceParser>
<initParams path="standard">
<lst name="defaults">
<str name="df">text</str>
</lst>
</initParams>
</config> </config>

View File

@ -72,4 +72,10 @@
</lst> </lst>
</requestHandler> </requestHandler>
<initParams path="standard">
<lst name="defaults">
<str name="df">text</str>
</lst>
</initParams>
</config> </config>

View File

@ -55,5 +55,11 @@
</requestHandler> </requestHandler>
<initParams path="/select">
<lst name="defaults">
<str name="df">text</str>
</lst>
</initParams>
</config> </config>

View File

@ -39,4 +39,10 @@
<httpCaching never304="true" /> <httpCaching never304="true" />
</requestDispatcher> </requestDispatcher>
<initParams path="standard">
<lst name="defaults">
<str name="df">text</str>
</lst>
</initParams>
</config> </config>

View File

@ -550,5 +550,11 @@ based HashBitset. -->
<processor class="solr.RunUpdateProcessorFactory" /> <processor class="solr.RunUpdateProcessorFactory" />
</updateRequestProcessorChain> </updateRequestProcessorChain>
<initParams path="standard,dismax,defaults,lazy,spellCheckCompRH,spellCheckWithWordbreak,spellCheckCompRH_Direct,spellCheckCompRH1,mltrh,tvrh,/terms">
<lst name="defaults">
<str name="df">text</str>
</lst>
</initParams>
</config> </config>

View File

@ -27,6 +27,7 @@
<requestHandler name="standard" class="solr.StandardRequestHandler"> <requestHandler name="standard" class="solr.StandardRequestHandler">
<lst name="defaults"> <lst name="defaults">
<bool name="hl.defaultSummary">false</bool> <bool name="hl.defaultSummary">false</bool>
<str name="df">text</str>
</lst> </lst>
</requestHandler> </requestHandler>
<searchComponent class="solr.HighlightComponent" name="highlight"> <searchComponent class="solr.HighlightComponent" name="highlight">

View File

@ -52,4 +52,10 @@
</lst> </lst>
</requestHandler> </requestHandler>
<initParams path="withlog,nolog">
<lst name="defaults">
<str name="df">text</str>
</lst>
</initParams>
</config> </config>

View File

@ -47,5 +47,10 @@
<maxTime>${solr.autoSoftCommit.maxTime:-1}</maxTime> <maxTime>${solr.autoSoftCommit.maxTime:-1}</maxTime>
</autoSoftCommit> </autoSoftCommit>
</updateHandler> </updateHandler>
<initParams path="standard">
<lst name="defaults">
<str name="df">text</str>
</lst>
</initParams>
</config> </config>

View File

@ -189,5 +189,10 @@
<str>spellcheck</str> <str>spellcheck</str>
</arr> </arr>
</requestHandler> </requestHandler>
<initParams path="spellCheckCompRH,spellCheckCompRH1,spellCheckWithWordbreak">
<lst name="defaults">
<str name="df">text</str>
</lst>
</initParams>
</config> </config>

View File

@ -115,5 +115,10 @@
<str>delayingSearchComponent</str> <str>delayingSearchComponent</str>
</arr> </arr>
</requestHandler> </requestHandler>
<initParams path="standard,/select">
<lst name="defaults">
<str name="df">text</str>
</lst>
</initParams>
</config> </config>

View File

@ -158,4 +158,10 @@
</query> </query>
<initParams path="standard">
<lst name="defaults">
<str name="df">text</str>
</lst>
</initParams>
</config> </config>

View File

@ -572,5 +572,11 @@
<str name="storageIO">org.apache.solr.rest.ManagedResourceStorage$InMemoryStorageIO</str> <str name="storageIO">org.apache.solr.rest.ManagedResourceStorage$InMemoryStorageIO</str>
</restManager> </restManager>
<initParams path="standard,dismax,defaults,lazy,spellCheckCompRH,spellCheckWithWordbreak,spellCheckCompRH_Direct,spellCheckCompRH1,mltrh,tvrh,/search-facet-def,/search-facet-invariants,/terms">
<lst name="defaults">
<str name="df">text</str>
</lst>
</initParams>
</config> </config>

View File

@ -283,7 +283,6 @@
<dynamicField name="random_*" type="random"/> <dynamicField name="random_*" type="random"/>
<defaultSearchField>text</defaultSearchField>
<uniqueKey>id</uniqueKey> <uniqueKey>id</uniqueKey>
<!-- example of a custom similarity --> <!-- example of a custom similarity -->

View File

@ -277,7 +277,6 @@
<dynamicField name="random_*" type="random"/> <dynamicField name="random_*" type="random"/>
<defaultSearchField>text</defaultSearchField>
<uniqueKey>id</uniqueKey> <uniqueKey>id</uniqueKey>
<!-- example of a custom similarity --> <!-- example of a custom similarity -->

View File

@ -42,6 +42,7 @@
<requestHandler name="crazy_custom_qt" class="solr.StandardRequestHandler"> <requestHandler name="crazy_custom_qt" class="solr.StandardRequestHandler">
<lst name="defaults"> <lst name="defaults">
<str name="fl">implicit</str> <str name="fl">implicit</str>
<str name="df">subject</str>
</lst> </lst>
</requestHandler> </requestHandler>
@ -54,4 +55,10 @@
<gettableFiles>solrconfig.xml schema.xml</gettableFiles> <gettableFiles>solrconfig.xml schema.xml</gettableFiles>
</admin> </admin>
<initParams path="standard,crazy_custom_qt">
<lst name="defaults">
<str name="df">subject</str>
</lst>
</initParams>
</config> </config>

View File

@ -41,6 +41,5 @@
<field name="subject" type="text" indexed="true" stored="true"/> <field name="subject" type="text" indexed="true" stored="true"/>
</fields> </fields>
<defaultSearchField>subject</defaultSearchField>
<uniqueKey>id</uniqueKey> <uniqueKey>id</uniqueKey>
</schema> </schema>

View File

@ -62,7 +62,7 @@ public class TestDistributedGrouping extends BaseDistributedSearchTestCase {
query("q", "*:*", "rows", 100, "fl", "id," + i1, "group", "true", "group.field", i1, "group.limit", -1, "sort", i1 + " asc, id asc", "hl","true","hl.fl",t1); query("q", "*:*", "rows", 100, "fl", "id," + i1, "group", "true", "group.field", i1, "group.limit", -1, "sort", i1 + " asc, id asc", "hl","true","hl.fl",t1);
query("q", "*:*", "rows", 100, "fl", "id," + i1, "group", "true", "group.field", i1, "group.limit", -1, "sort", i1 + " asc, id asc", "facet", "true", "facet.field", t1); query("q", "*:*", "rows", 100, "fl", "id," + i1, "group", "true", "group.field", i1, "group.limit", -1, "sort", i1 + " asc, id asc", "facet", "true", "facet.field", t1);
query("q", "*:*", "rows", 100, "fl", "id," + i1, "group", "true", "group.field", i1, "group.limit", -1, "sort", i1 + " asc, id asc", "stats", "true", "stats.field", i1); query("q", "*:*", "rows", 100, "fl", "id," + i1, "group", "true", "group.field", i1, "group.limit", -1, "sort", i1 + " asc, id asc", "stats", "true", "stats.field", i1);
query("q", "kings", "rows", 100, "fl", "id," + i1, "group", "true", "group.field", i1, "group.limit", -1, "sort", i1 + " asc, id asc", "spellcheck", "true", "spellcheck.build", "true", "qt", "spellCheckCompRH"); query("q", "kings", "rows", 100, "fl", "id," + i1, "group", "true", "group.field", i1, "group.limit", -1, "sort", i1 + " asc, id asc", "spellcheck", "true", "spellcheck.build", "true", "qt", "spellCheckCompRH", "df", "subject");
query("q", "*:*", "fq", s1 + ":a", "rows", 100, "fl", "id," + i1, "group", "true", "group.field", i1, "group.limit", -1, "sort", i1 + " asc, id asc", "group.truncate", "true", "facet", "true", "facet.field", t1); query("q", "*:*", "fq", s1 + ":a", "rows", 100, "fl", "id," + i1, "group", "true", "group.field", i1, "group.limit", -1, "sort", i1 + " asc, id asc", "group.truncate", "true", "facet", "true", "facet.field", t1);
indexr(id,1, i1, 100, tlong, 100, i1dv, 100, t1,"now is the time for all good men", indexr(id,1, i1, 100, tlong, 100, i1dv, 100, t1,"now is the time for all good men",
@ -160,7 +160,7 @@ public class TestDistributedGrouping extends BaseDistributedSearchTestCase {
query("q", "*:*", "rows", 100, "fl", "id," + i1, "group", "true", "group.field", i1, "group.limit", -1, "sort", "{!func}add(" + i1 + ",5) asc, id asc"); query("q", "*:*", "rows", 100, "fl", "id," + i1, "group", "true", "group.field", i1, "group.limit", -1, "sort", "{!func}add(" + i1 + ",5) asc, id asc");
query("q", "*:*", "rows", 100, "fl", "id," + i1, "group", "true", "group.field", i1, "group.limit", -1, "sort", i1 + " asc, id asc", "facet", "true", "facet.field", t1); query("q", "*:*", "rows", 100, "fl", "id," + i1, "group", "true", "group.field", i1, "group.limit", -1, "sort", i1 + " asc, id asc", "facet", "true", "facet.field", t1);
query("q", "*:*", "rows", 100, "fl", "id," + i1, "group", "true", "group.field", i1, "group.limit", -1, "sort", i1 + " asc, id asc", "stats", "true", "stats.field", tlong); query("q", "*:*", "rows", 100, "fl", "id," + i1, "group", "true", "group.field", i1, "group.limit", -1, "sort", i1 + " asc, id asc", "stats", "true", "stats.field", tlong);
query("q", "kings", "rows", 100, "fl", "id," + i1, "group", "true", "group.field", i1, "group.limit", -1, "sort", i1 + " asc, id asc", "spellcheck", "true", "spellcheck.build", "true", "qt", "spellCheckCompRH"); query("q", "kings", "rows", 100, "fl", "id," + i1, "group", "true", "group.field", i1, "group.limit", -1, "sort", i1 + " asc, id asc", "spellcheck", "true", "spellcheck.build", "true", "qt", "spellCheckCompRH", "df", "subject");
query("q", "*:*", "rows", 100, "fl", "id," + i1, "group", "true", "group.field", i1, "group.limit", -1, "sort", i1 + " asc, id asc", "facet", "true", "hl","true","hl.fl",t1); query("q", "*:*", "rows", 100, "fl", "id," + i1, "group", "true", "group.field", i1, "group.limit", -1, "sort", i1 + " asc, id asc", "facet", "true", "hl","true","hl.fl",t1);
query("q", "*:*", "rows", 100, "fl", "id," + i1, "group", "true", "group.field", i1, "group.limit", -1, "sort", i1 + " asc, id asc", "group.sort", "id desc"); query("q", "*:*", "rows", 100, "fl", "id," + i1, "group", "true", "group.field", i1, "group.limit", -1, "sort", i1 + " asc, id asc", "group.sort", "id desc");

View File

@ -414,8 +414,8 @@ public class TestSolrConfigHandler extends RestTestBase {
List l = (List) Utils.getObjectByPath(map, false, Arrays.asList("config", "initParams")); List l = (List) Utils.getObjectByPath(map, false, Arrays.asList("config", "initParams"));
assertNotNull("no object /config/initParams : "+ TestBlobHandler.getAsString(map) , l); assertNotNull("no object /config/initParams : "+ TestBlobHandler.getAsString(map) , l);
assertEquals( 1, l.size()); assertEquals( 2, l.size());
assertEquals( "val", ((Map)l.get(0)).get("key") ); assertEquals( "val", ((Map)l.get(1)).get("key") );
payload = "{\n" + payload = "{\n" +

View File

@ -101,6 +101,7 @@ public class HighlighterMaxOffsetTest extends SolrTestCaseJ4 {
private static void assertHighlighting(String field) throws Exception { private static void assertHighlighting(String field) throws Exception {
assertQ(req("q", "id:DOC1", assertQ(req("q", "id:DOC1",
"df", "content",
"hl.q", "JPEG", "hl.q", "JPEG",
"indent", "true", "indent", "true",
"hl", "true", "hl", "true",

View File

@ -1,28 +0,0 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.solr.rest.schema;
import org.apache.solr.rest.SolrRestletTestBase;
import org.junit.Test;
public class TestDefaultSearchFieldResource extends SolrRestletTestBase {
@Test
public void testGetDefaultSearchField() throws Exception {
assertQ("/schema/defaultsearchfield?indent=on&wt=xml",
"count(/response/str[@name='defaultSearchField']) = 1",
"/response/str[@name='defaultSearchField'][.='text']");
}
}

View File

@ -32,9 +32,6 @@ public class TestSchemaResource extends SolrRestletTestBase {
"count(/response/lst[@name='schema']/str[@name='uniqueKey']) = 1", "count(/response/lst[@name='schema']/str[@name='uniqueKey']) = 1",
"/response/lst[@name='schema']/str[@name='uniqueKey'][.='id']", "/response/lst[@name='schema']/str[@name='uniqueKey'][.='id']",
"count(/response/lst[@name='schema']/str[@name='defaultSearchField']) = 1",
"/response/lst[@name='schema']/str[@name='defaultSearchField'][.='text']",
"(/response/lst[@name='schema']/arr[@name='fieldTypes']/lst/str[@name='name'])[1] = 'HTMLstandardtok'", "(/response/lst[@name='schema']/arr[@name='fieldTypes']/lst/str[@name='name'])[1] = 'HTMLstandardtok'",
"(/response/lst[@name='schema']/arr[@name='fieldTypes']/lst/str[@name='name'])[2] = 'HTMLwhitetok'", "(/response/lst[@name='schema']/arr[@name='fieldTypes']/lst/str[@name='name'])[2] = 'HTMLwhitetok'",
"(/response/lst[@name='schema']/arr[@name='fieldTypes']/lst/str[@name='name'])[3] = 'boolean'", "(/response/lst[@name='schema']/arr[@name='fieldTypes']/lst/str[@name='name'])[3] = 'boolean'",
@ -111,7 +108,6 @@ public class TestSchemaResource extends SolrRestletTestBase {
"/schema/name=='test-rest'", "/schema/name=='test-rest'",
"/schema/version==1.6", "/schema/version==1.6",
"/schema/uniqueKey=='id'", "/schema/uniqueKey=='id'",
"/schema/defaultSearchField=='text'",
"/schema/fieldTypes/[0]/name=='HTMLstandardtok'", "/schema/fieldTypes/[0]/name=='HTMLstandardtok'",
"/schema/fieldTypes/[1]/name=='HTMLwhitetok'", "/schema/fieldTypes/[1]/name=='HTMLwhitetok'",
@ -151,7 +147,6 @@ public class TestSchemaResource extends SolrRestletTestBase {
"/schema/@name = 'test-rest'", "/schema/@name = 'test-rest'",
"/schema/@version = '1.6'", "/schema/@version = '1.6'",
"/schema/uniqueKey = 'id'", "/schema/uniqueKey = 'id'",
"/schema/defaultSearchField = 'text'",
"(/schema/fieldType)[1]/@name = 'HTMLstandardtok'", "(/schema/fieldType)[1]/@name = 'HTMLstandardtok'",
"(/schema/fieldType)[2]/@name = 'HTMLwhitetok'", "(/schema/fieldType)[2]/@name = 'HTMLwhitetok'",

View File

@ -1011,7 +1011,7 @@ public class QueryEqualityTest extends SolrTestCaseJ4 {
*/ */
protected void assertQueryEquals(final String defType, protected void assertQueryEquals(final String defType,
final String... inputs) throws Exception { final String... inputs) throws Exception {
SolrQueryRequest req = req(); SolrQueryRequest req = req(new String[] {"df", "text"});
try { try {
assertQueryEquals(defType, req, inputs); assertQueryEquals(defType, req, inputs);
} finally { } finally {
@ -1173,4 +1173,9 @@ public class QueryEqualityTest extends SolrTestCaseJ4 {
req.close(); req.close();
} }
} }
// Override req to add df param
public static SolrQueryRequest req(String... q) {
return SolrTestCaseJ4.req(q, "df", "text");
}
} }

View File

@ -40,7 +40,7 @@ public class QueryParsingTest extends SolrTestCaseJ4 {
*/ */
public void testQParserEmptyInput() throws Exception { public void testQParserEmptyInput() throws Exception {
SolrQueryRequest req = req(); SolrQueryRequest req = req("df", "text");
final String[] parsersTested = new String[] { final String[] parsersTested = new String[] {
OldLuceneQParserPlugin.NAME, OldLuceneQParserPlugin.NAME,

View File

@ -1771,10 +1771,13 @@ public class TestExtendedDismaxParser extends SolrTestCaseJ4 {
public void testAutoGeneratePhraseQueries() throws Exception { public void testAutoGeneratePhraseQueries() throws Exception {
ModifiableSolrParams noSowParams = new ModifiableSolrParams(); ModifiableSolrParams noSowParams = new ModifiableSolrParams();
noSowParams.add("df", "text");
ModifiableSolrParams sowFalseParams = new ModifiableSolrParams(); ModifiableSolrParams sowFalseParams = new ModifiableSolrParams();
sowFalseParams.add("sow", "false"); sowFalseParams.add("sow", "false");
sowFalseParams.add("df", "text");
ModifiableSolrParams sowTrueParams = new ModifiableSolrParams(); ModifiableSolrParams sowTrueParams = new ModifiableSolrParams();
sowTrueParams.add("sow", "true"); sowTrueParams.add("sow", "true");
sowTrueParams.add("df", "text");
// From synonyms.txt: // From synonyms.txt:
// //

View File

@ -19,6 +19,7 @@ package org.apache.solr.search;
import org.apache.lucene.index.Term; import org.apache.lucene.index.Term;
import org.apache.lucene.legacy.LegacyNumericRangeQuery; import org.apache.lucene.legacy.LegacyNumericRangeQuery;
import org.apache.lucene.search.*; import org.apache.lucene.search.*;
import org.apache.solr.common.params.MapSolrParams;
import org.apache.solr.common.params.ModifiableSolrParams; import org.apache.solr.common.params.ModifiableSolrParams;
import org.apache.solr.util.AbstractSolrTestCase; import org.apache.solr.util.AbstractSolrTestCase;
import org.junit.BeforeClass; import org.junit.BeforeClass;
@ -27,6 +28,7 @@ import org.junit.Test;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Collections;
public class TestMaxScoreQueryParser extends AbstractSolrTestCase { public class TestMaxScoreQueryParser extends AbstractSolrTestCase {
Query q; Query q;
@ -141,7 +143,7 @@ public class TestMaxScoreQueryParser extends AbstractSolrTestCase {
while(al.size() >= 2) { while(al.size() >= 2) {
p.add(al.remove(0), al.remove(0)); p.add(al.remove(0), al.remove(0));
} }
return new MaxScoreQParser(q, p, new ModifiableSolrParams(), req(q)).parse(); return new MaxScoreQParser(q, p, new MapSolrParams(Collections.singletonMap("df", "text")), req(q)).parse();
} catch (SyntaxError syntaxError) { } catch (SyntaxError syntaxError) {
fail("Failed with exception "+syntaxError.getMessage()); fail("Failed with exception "+syntaxError.getMessage());
} }

View File

@ -91,6 +91,7 @@ public class TestReRankQParserPlugin extends SolrTestCaseJ4 {
params.add("bff", "field(test_ti)"); params.add("bff", "field(test_ti)");
params.add("start", "0"); params.add("start", "0");
params.add("rows", "6"); params.add("rows", "6");
params.add("df", "text");
assertQ(req(params), "*[count(//doc)=6]", assertQ(req(params), "*[count(//doc)=6]",
"//result/doc[1]/float[@name='id'][.='3.0']", "//result/doc[1]/float[@name='id'][.='3.0']",
"//result/doc[2]/float[@name='id'][.='4.0']", "//result/doc[2]/float[@name='id'][.='4.0']",
@ -109,6 +110,7 @@ public class TestReRankQParserPlugin extends SolrTestCaseJ4 {
params.add("fl", "id,score"); params.add("fl", "id,score");
params.add("start", "0"); params.add("start", "0");
params.add("rows", "10"); params.add("rows", "10");
params.add("df", "text");
assertQ(req(params), "*[count(//doc)=6]", assertQ(req(params), "*[count(//doc)=6]",
"//result/doc[1]/float[@name='id'][.='2.0']", "//result/doc[1]/float[@name='id'][.='2.0']",
@ -130,6 +132,7 @@ public class TestReRankQParserPlugin extends SolrTestCaseJ4 {
params.add("start", "0"); params.add("start", "0");
params.add("rows", "10"); params.add("rows", "10");
params.add("sort", "score desc"); params.add("sort", "score desc");
params.add("df", "text");
assertQ(req(params), "*[count(//doc)=6]", assertQ(req(params), "*[count(//doc)=6]",
"//result/doc[1]/float[@name='id'][.='2.0']", "//result/doc[1]/float[@name='id'][.='2.0']",
"//result/doc[2]/float[@name='id'][.='6.0']", "//result/doc[2]/float[@name='id'][.='6.0']",
@ -151,6 +154,7 @@ public class TestReRankQParserPlugin extends SolrTestCaseJ4 {
params.add("start", "0"); params.add("start", "0");
params.add("rows", "10"); params.add("rows", "10");
params.add("sort", "score desc,test_ti asc"); params.add("sort", "score desc,test_ti asc");
params.add("df", "text");
assertQ(req(params), "*[count(//doc)=6]", assertQ(req(params), "*[count(//doc)=6]",
"//result/doc[1]/float[@name='id'][.='2.0']", "//result/doc[1]/float[@name='id'][.='2.0']",
@ -194,6 +198,7 @@ public class TestReRankQParserPlugin extends SolrTestCaseJ4 {
params.add("fl", "id,score"); params.add("fl", "id,score");
params.add("start", "0"); params.add("start", "0");
params.add("rows", "10"); params.add("rows", "10");
params.add("df", "text");
assertQ(req(params), "*[count(//doc)=6]", assertQ(req(params), "*[count(//doc)=6]",
"//result/doc[1]/float[@name='id'][.='2.0']", "//result/doc[1]/float[@name='id'][.='2.0']",
@ -548,6 +553,7 @@ public class TestReRankQParserPlugin extends SolrTestCaseJ4 {
params.add("fl", "id,score"); params.add("fl", "id,score");
params.add("start", "0"); params.add("start", "0");
params.add("rows", "2"); params.add("rows", "2");
params.add("df", "text");
assertQ(req(params), "*[count(//doc)=2]", assertQ(req(params), "*[count(//doc)=2]",
"//result/doc[1]/float[@name='id'][.='8.0']", "//result/doc[1]/float[@name='id'][.='8.0']",

View File

@ -63,8 +63,8 @@ public class TestSimpleQParserPlugin extends SolrTestCaseJ4 {
@Test @Test
public void testDefaultField() throws Exception { public void testDefaultField() throws Exception {
assertJQ(req("defType", "simple", "q", "t2 t9 t12"), "/response/numFound==1"); assertJQ(req("defType", "simple", "df", "text0", "q", "t2 t9 t12"), "/response/numFound==1");
assertJQ(req("defType", "simple", "q", "t3"), "/response/numFound==0"); assertJQ(req("defType", "simple", "df", "text0", "q", "t3"), "/response/numFound==0");
assertJQ(req("defType", "simple", "df", "text1", "q", "t2 t9 t12"), "/response/numFound==3"); assertJQ(req("defType", "simple", "df", "text1", "q", "t2 t9 t12"), "/response/numFound==3");
assertJQ(req("defType", "simple", "df", "text1", "q", "t3"), "/response/numFound==1"); assertJQ(req("defType", "simple", "df", "text1", "q", "t3"), "/response/numFound==1");
assertJQ(req("defType", "simple", "df", "text-keyword0", "q", "\"kw9 kw10 kw11\""), "/response/numFound==1"); assertJQ(req("defType", "simple", "df", "text-keyword0", "q", "\"kw9 kw10 kw11\""), "/response/numFound==1");

View File

@ -196,6 +196,7 @@ public class BlockJoinFacetRandomTest extends SolrTestCaseJ4 {
BlockJoinFacetComponent.NO_TO_PARENT_BJQ_MESSAGE, BlockJoinFacetComponent.NO_TO_PARENT_BJQ_MESSAGE,
req( req(
"q", "t", "q", "t",
"df", "name",
"qt", handler, "qt", handler,
BlockJoinFacetComponent.CHILD_FACET_FIELD_PARAMETER, facetFields[0] BlockJoinFacetComponent.CHILD_FACET_FIELD_PARAMETER, facetFields[0]
), ),

View File

@ -35,6 +35,7 @@ import org.apache.lucene.search.TermQuery;
import org.apache.solr.SolrTestCaseJ4; import org.apache.solr.SolrTestCaseJ4;
import org.apache.solr.request.SolrQueryRequest; import org.apache.solr.request.SolrQueryRequest;
import org.apache.solr.search.QParser; import org.apache.solr.search.QParser;
import org.apache.solr.search.QueryParsing;
import org.apache.solr.util.SolrPluginUtils.DisjunctionMaxQueryParser; import org.apache.solr.util.SolrPluginUtils.DisjunctionMaxQueryParser;
import org.junit.BeforeClass; import org.junit.BeforeClass;
import org.junit.Test; import org.junit.Test;
@ -126,11 +127,11 @@ public class SolrPluginUtilsTest extends SolrTestCaseJ4 {
Query out; Query out;
String t; String t;
SolrQueryRequest req = req(); SolrQueryRequest req = req("df", "text");
QParser qparser = QParser.getParser("hi", "dismax", req); QParser qparser = QParser.getParser("hi", "dismax", req);
DisjunctionMaxQueryParser qp = DisjunctionMaxQueryParser qp =
new SolrPluginUtils.DisjunctionMaxQueryParser(qparser, req.getSchema().getDefaultSearchFieldName()); new SolrPluginUtils.DisjunctionMaxQueryParser(qparser, QueryParsing.getDefaultField(req.getSchema(), req.getParams().get("df")));
qp.addAlias("hoss", 0.01f, SolrPluginUtils.parseFieldBoosts qp.addAlias("hoss", 0.01f, SolrPluginUtils.parseFieldBoosts
("title^2.0 title_stemmed name^1.2 subject^0.5")); ("title^2.0 title_stemmed name^1.2 subject^0.5"));
@ -147,7 +148,7 @@ public class SolrPluginUtilsTest extends SolrTestCaseJ4 {
assertTrue(t+" sanity test isn't TermQuery: " + out.getClass(), assertTrue(t+" sanity test isn't TermQuery: " + out.getClass(),
out instanceof TermQuery); out instanceof TermQuery);
assertEquals(t+" sanity test is wrong field", assertEquals(t+" sanity test is wrong field",
h.getCore().getLatestSchema().getDefaultSearchFieldName(), qp.getDefaultField(),
((TermQuery)out).getTerm().field()); ((TermQuery)out).getTerm().field());
t = "subject:XXXXXXXX"; t = "subject:XXXXXXXX";

View File

@ -616,7 +616,6 @@
<dynamicField name="*_sim3" type="sim3" indexed="true" stored="true"/> <dynamicField name="*_sim3" type="sim3" indexed="true" stored="true"/>
--> -->
<defaultSearchField>text</defaultSearchField>
<uniqueKey>id</uniqueKey> <uniqueKey>id</uniqueKey>
<!-- copyField commands copy one field to another at the time a document <!-- copyField commands copy one field to another at the time a document

View File

@ -584,7 +584,6 @@
<dynamicField name="*_sim3" type="sim3" indexed="true" stored="true"/> <dynamicField name="*_sim3" type="sim3" indexed="true" stored="true"/>
--> -->
<defaultSearchField>text</defaultSearchField>
<uniqueKey>id</uniqueKey> <uniqueKey>id</uniqueKey>
<!-- copyField commands copy one field to another at the time a document <!-- copyField commands copy one field to another at the time a document

View File

@ -57,8 +57,5 @@
<!-- field to use to determine and enforce document uniqueness. --> <!-- field to use to determine and enforce document uniqueness. -->
<uniqueKey>id</uniqueKey> <uniqueKey>id</uniqueKey>
<!-- field for the QueryParser to use when an explicit fieldname is absent -->
<defaultSearchField>name</defaultSearchField>
</schema> </schema>

View File

@ -46,5 +46,11 @@
<defaultQuery>solr</defaultQuery> <defaultQuery>solr</defaultQuery>
</admin> </admin>
<initParams path="standard">
<lst name="defaults">
<str name="df">name</str>
</lst>
</initParams>
</config> </config>

View File

@ -609,7 +609,6 @@
<dynamicField name="*_sim3" type="sim3" indexed="true" stored="true"/> <dynamicField name="*_sim3" type="sim3" indexed="true" stored="true"/>
--> -->
<defaultSearchField>text</defaultSearchField>
<uniqueKey>id</uniqueKey> <uniqueKey>id</uniqueKey>
<!-- copyField commands copy one field to another at the time a document <!-- copyField commands copy one field to another at the time a document

View File

@ -47,5 +47,11 @@
<defaultQuery>solr</defaultQuery> <defaultQuery>solr</defaultQuery>
</admin> </admin>
<initParams path="standard">
<lst name="defaults">
<str name="df">text</str>
</lst>
</initParams>
</config> </config>

View File

@ -46,6 +46,5 @@ that just finds leaf <fieldType> and <field> nodes and there's no reason to brea
<field name="subject" type="text" indexed="true" stored="true"/> <field name="subject" type="text" indexed="true" stored="true"/>
</fields> </fields>
<defaultSearchField>subject</defaultSearchField>
<uniqueKey>id</uniqueKey> <uniqueKey>id</uniqueKey>
</schema> </schema>

Some files were not shown because too many files have changed in this diff Show More