TAMULib / SAGE

Search Aggregation Engine
MIT License
6 stars 1 forks source link

For Dismax Parser, provide proper wildcard defaults for when "q" is empty. #535

Open kaladay opened 1 year ago

kaladay commented 1 year ago

Describe the bug The Dismax Parser does not support wild cards * (U+002A).

The current query logic in SolrDiscoveryService.java adds the wildcard filter to the query itself and is not Parser aware.

Searching with an empty q produces no results.

Based on the documentation, the q.alt parameter should be used for this purpose and the wild card must not be put in the q parameter.

This is also true for the Edismax Parser, but this must no be done for the Lucene Parser. The Lucense Parser does not support q.alt and adding a default to the q for when it is empty might be the correct action.

Until this is resolved, the Dismax Parser should be avoided or the default filter should be empty in the Discovery View.

The behavior of field-specific wildcard search should still be preserved.

Such as searching for q=origin:*, which should not become q.alt=origin:* for the Dismax Parser and the Edismax Parser.

Take care with the Lucense Parser as the q is required by that parser.

To Reproduce Steps to reproduce the behavior:

  1. Read the referenced solr documentation.
  2. Got to the solr panel and experiment with the queries, such as: debug=query&defType=dismax&sow=true&rows=0 and q.alt=*&debug=query&defType=dismax&sow=true&rows=0.
  3. See results.

Expected behavior We should have consistent behavior between each of the parsers and the filter from the Discovery View should be properly used.

Additional context see: https://solr.apache.org/guide/solr/latest/query-guide/dismax-query-parser.html#q-alt-parameter see: https://solr.apache.org/guide/solr/latest/query-guide/standard-query-parser.html