You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Bernd Fehling <be...@uni-bielefeld.de> on 2012/06/08 16:15:05 UTC

defaultSearchField and param df are messed up in 3.6.x

Unfortunately I must see that defaultSearchField and param df are
pretty much messed up in solr 3.6.x
Yes, I have seen issue SOLR-2724 and SOLR-3292.

So if defaultSearchField has been removed (deprecated) from schema.xml then why
are the still calls to "org.apache.solr.schema.IndexSchema.getDefaultSearchFieldName()"?

All these calls get no result, because there is no defaultSearchField.
This also breaks edismax (ExtendedDismaxQParserPlugin) and several other.
As example in method parse() it tries
...
    queryFields = U.parseFieldBoosts(solrParams.getParams(DMP.QF));
    if (0 == queryFields.size()) {
      queryFields.put(req.getSchema().getDefaultSearchFieldName(), 1.0f);
    }
...

Guess what, yes no result and an empty search :-(
A grep for "getDefaultSearchFieldName" pointed out that there are several
places where this method is still in use for sorl 3.6.x.

A workaround is to enable defaultSearchField in schema.xml again.

Or to fix all places in the code, e.g. for ExtendedDismaxQParserPlugin method parse()
must then read
...
    queryFields = U.parseFieldBoosts(solrParams.getParams(DMP.QF));
    if (0 == queryFields.size()) {
      queryFields.put(solrParams.getParams("df"));
    }
...

or something similar.

I would also recommend to enable defaultOperator in schema.xml again. Just in case
they forgot to fix places where they try to access defaultOperator.


Regards
Bernd

Re: defaultSearchField and param df are messed up in 3.6.x

Posted by Chris Hostetter <ho...@fucit.org>.
: So if defaultSearchField has been removed (deprecated) from schema.xml then why
: are the still calls to "org.apache.solr.schema.IndexSchema.getDefaultSearchFieldName()"?

Because even though the syntax is deprecated/discouraged in schema.xml, we 
don't want things to break for existing users who have it in their 
schema.xml -- hence the method is still called.

If you upgrade from a previous version, your old configs should still work 
-- if you start from scratch with the Solr 3.6 example, then you should 
follow the lead of hte Solr 3.6 example and specify df/qf as appropriate 
for your usecase.  There are certainly improvements that can be made in 
how the chain of defaults works (hence SOLR-3534) but I don't see any way 
that this change "broke" anything for existing users -- if you can provide 
an example of a query + configs that worked in Solr 3.5 but don't work in 
Solr 3.6 then please, please, please file a bug with that information so 
we can understand what happened.


-Hoss

Re: defaultSearchField and param df are messed up in 3.6.x

Posted by Jack Krupansky <ja...@basetechnology.com>.
Besides the obvious need to clean up the getDefaultSearchFieldName 
references, I would also suggest that the "df" param have a hard-wired 
default of "text" since that is the obvious default.

-- Jack Krupansky

-----Original Message----- 
From: Bernd Fehling
Sent: Friday, June 08, 2012 10:15 AM
To: solr-user@lucene.apache.org
Subject: defaultSearchField and param df are messed up in 3.6.x

Unfortunately I must see that defaultSearchField and param df are
pretty much messed up in solr 3.6.x
Yes, I have seen issue SOLR-2724 and SOLR-3292.

So if defaultSearchField has been removed (deprecated) from schema.xml then 
why
are the still calls to 
"org.apache.solr.schema.IndexSchema.getDefaultSearchFieldName()"?

All these calls get no result, because there is no defaultSearchField.
This also breaks edismax (ExtendedDismaxQParserPlugin) and several other.
As example in method parse() it tries
...
    queryFields = U.parseFieldBoosts(solrParams.getParams(DMP.QF));
    if (0 == queryFields.size()) {
      queryFields.put(req.getSchema().getDefaultSearchFieldName(), 1.0f);
    }
...

Guess what, yes no result and an empty search :-(
A grep for "getDefaultSearchFieldName" pointed out that there are several
places where this method is still in use for sorl 3.6.x.

A workaround is to enable defaultSearchField in schema.xml again.

Or to fix all places in the code, e.g. for ExtendedDismaxQParserPlugin 
method parse()
must then read
...
    queryFields = U.parseFieldBoosts(solrParams.getParams(DMP.QF));
    if (0 == queryFields.size()) {
      queryFields.put(solrParams.getParams("df"));
    }
...

or something similar.

I would also recommend to enable defaultOperator in schema.xml again. Just 
in case
they forgot to fix places where they try to access defaultOperator.


Regards
Bernd