On 5/29/2018 5:10 AM, Riyaz wrote:
We had come across a requirement to allow empty parameter values to query
string(q), start and rows as part of solr search query.

In solr 3.4, have added defType to edismax and it's allowing empty params

http://<solrhost>/solr/<core>/select?&wt=xml&indent=true&rows=&start="
-->working fine in solr 3.4

I would say that the behavior in 3.x is the problem here. Version 3.4.0 is nearly seven years old.

An empty value for the "q" parameter is a situation that Solr is explicitly looking for.  When q is missing or empty, the value in q.alt is used instead, with the standard Lucene parser.

Behavior is undefined for an empty value on parameters like start and rows.

while applying the same changes in solr-5.3.1, empty rows/start parameter
causing "java.lang.NumberFormatException: For input string: """.

The newer version is validating that what you're sending is an actual valid number, and throwing an error early when it's not.  The latest version I have downloaded right now is 7.3.0, and it behaves the same as 5.3.1.  The latest 3.x (3.6.2) accepts the empty parameters, and the latest 4.x (4.10.4) does not accept them.  As you have seen, 5.x doesn't accept them.  All three of these major versions are out of date and no longer receive updates.  I did not try any 6.x versions for this problem, but they probably behave the same as 5.x and 7.x.

Can you please let us know, is there any way to do this?.

If you want a query to use defaults for these parameters, don't include them on the query URL at all.  Solr will use the defaults that you have defined on the handler in solrconfig.xml.

I don't consider the behavior you're seeing to be a bug.  I think that it's correct to throw an error in this situation, and that 3.x behaves incorrectly by NOT throwing an error.

Thanks,
Shawn

Reply via email to