SOLR-1036: Change default QParser from "lucenePlusSort" to "lucene"

git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@748763 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Chris M. Hostetter 2009-02-28 00:36:30 +00:00
parent 59cbcf51a7
commit 32c63cea8e
5 changed files with 23 additions and 3 deletions

View File

@ -32,6 +32,14 @@ the index smaller and faster. If you are upgrading from an earlier Solr
release and want to enable omitTf by default, change the schema version from
1.1 to 1.2 in schema.xml. Remove any existing index and restart Solr to ensure that omitTf completely takes affect.
The default QParserPlugin used by the QueryComponent for parsing the "q" param
has been changed, to remove support for the deprecated use of ";" as a separator
between the query string and the sort options when no "sort" param was used.
Users who wish to continue using the semi-colon based method of specifying the
sort options should explicitly set the defType param to "lucenePlusSort" on all
requests. (The simplest way to do this is by specifying it as a default param
for your request handlers in solrconfig.xml, see the example solrconfig.xml for
sample syntax.)
Detailed Change List
----------------------
@ -330,6 +338,9 @@ Other Changes
19. SOLR-967: New type-safe constructor for NamedList (Kay Kay via hossman)
20. SOLR-1036: Change default QParser from "lucenePlusSort" to "lucene" to
reduce confusion of semicolon splitting behavior when no sort param is
specified (hossman)
Build
----------------------

View File

@ -75,7 +75,7 @@ public class QueryComponent extends SearchComponent
rb.setFieldFlags( fieldFlags );
String defType = params.get(QueryParsing.DEFTYPE);
defType = defType==null ? OldLuceneQParserPlugin.NAME : defType;
defType = defType==null ? QParserPlugin.DEFAULT_QTYPE : defType;
if (rb.getQueryString() == null) {
rb.setQueryString( params.get( CommonParams.Q ) );

View File

@ -22,11 +22,11 @@ import org.apache.solr.util.plugin.NamedListInitializedPlugin;
public abstract class QParserPlugin implements NamedListInitializedPlugin {
/** internal use - name of the default parser */
public static String DEFAULT_QTYPE="lucene";
public static String DEFAULT_QTYPE = LuceneQParserPlugin.NAME;
/** internal use - name to class mappings of builtin parsers */
public static final Object[] standardPlugins = {
DEFAULT_QTYPE, LuceneQParserPlugin.class,
LuceneQParserPlugin.NAME, LuceneQParserPlugin.class,
OldLuceneQParserPlugin.NAME, OldLuceneQParserPlugin.class,
FunctionQParserPlugin.NAME, FunctionQParserPlugin.class,
PrefixQParserPlugin.NAME, PrefixQParserPlugin.class,

View File

@ -39,6 +39,7 @@ public class ConvertedLegacyTest extends AbstractSolrTestCase {
SolrQueryRequest req = null;
Map<String,String> args = new HashMap<String,String>();
lrf.args.put("version","2.0");
lrf.args.put("defType","lucenePlusSort");
// compact the index, keep things from getting out of hand
@ -222,6 +223,7 @@ public class ConvertedLegacyTest extends AbstractSolrTestCase {
);
args = new HashMap<String,String>();
args.put("version","2.0");
args.put("defType","lucenePlusSort");
req = new LocalSolrQueryRequest(h.getCore(), "val_s:[a TO z];val_s asc",
"standard", 0, 0 , args);
assertQ(req
@ -230,6 +232,7 @@ public class ConvertedLegacyTest extends AbstractSolrTestCase {
);
args = new HashMap<String,String>();
args.put("version","2.0");
args.put("defType","lucenePlusSort");
req = new LocalSolrQueryRequest(h.getCore(), "val_s:[a TO z];val_s desc",
"standard", 0, 0 , args);
assertQ(req
@ -1171,6 +1174,7 @@ public class ConvertedLegacyTest extends AbstractSolrTestCase {
args = new HashMap<String,String>();
args.put("version","2.0");
args.put("fl","score ");
args.put("defType","lucenePlusSort");
req = new LocalSolrQueryRequest(h.getCore(), "id:44;id desc;",
"standard", 0, 10, args);
assertQ(req
@ -1179,6 +1183,7 @@ public class ConvertedLegacyTest extends AbstractSolrTestCase {
args = new HashMap<String,String>();
args.put("version","2.0");
args.put("fl","score ");
args.put("defType","lucenePlusSort");
req = new LocalSolrQueryRequest(h.getCore(), "id:44;",
"standard", 0, 10, args);
assertQ(req
@ -1187,6 +1192,7 @@ public class ConvertedLegacyTest extends AbstractSolrTestCase {
args = new HashMap<String,String>();
args.put("version","2.0");
args.put("fl","score ");
args.put("defType","lucenePlusSort");
req = new LocalSolrQueryRequest(h.getCore(), "id:44;id desc;",
"standard", 0, 10, args);
assertQ(req
@ -1195,6 +1201,7 @@ public class ConvertedLegacyTest extends AbstractSolrTestCase {
args = new HashMap<String,String>();
args.put("version","2.0");
args.put("fl","score");
args.put("defType","lucenePlusSort");
req = new LocalSolrQueryRequest(h.getCore(), "id:44;id desc;",
"standard", 0, 0 , args);
assertQ(req

View File

@ -25,6 +25,7 @@ import org.apache.solr.common.params.MapSolrParams;
import org.apache.solr.core.SolrCore;
import org.apache.solr.request.LocalSolrQueryRequest;
import org.apache.solr.request.SolrQueryRequest;
import org.apache.solr.search.QueryParsing;
import org.apache.solr.util.AbstractSolrTestCase;
/**
@ -82,6 +83,7 @@ public class StandardRequestHandlerTest extends AbstractSolrTestCase {
// Using legacy ';' param
args.remove( CommonParams.SORT );
args.put( QueryParsing.DEFTYPE, "lucenePlusSort" );
args.put( CommonParams.Q, "title:test; val_s desc" );
assertQ("with sort param [desc]", req
,"//*[@numFound='3']"