TAMULib / SAGE

Search Aggregation Engine
MIT License
6 stars 1 forks source link

Default Field and wild cards don't work as expected. #528

Closed kaladay closed 1 year ago

kaladay commented 1 year ago

Description

One would expect that when the default field is set to say origin, then the default wild card would be against the origin. This is not the case.

If there is no value but there is a search field, then prepend the search field before the wild card like origin:*.

The regressed behavior would result in an parsed query of:

{
  "responseHeader":{
    "status":0,
    "QTime":0,
    "params":{
      "q":"*",
      "df":"origin",
      "debug":"query",
      "sow":"true",
      "rows":"0",
      "_":"1675954886742"}},
  "response":{"numFound":6494,"start":0,"docs":[]
  },
  "debug":{
    "rawquerystring":"*",
    "querystring":"*",
    "parsedquery":"MatchAllDocsQuery(*:*)",
    "parsedquery_toString":"*:*",
    "QParser":"LuceneQParser"
  }
}

Adding the default search of origin before the wild card results in:

{
  "responseHeader":{
    "status":0,
    "QTime":0,
    "params":{
      "q":"origin:*",
      "df":"origin",
      "debug":"query",
      "sow":"true",
      "rows":"0",
      "_":"1675954886742"}},
  "response":{"numFound":724,"start":0,"docs":[]
  },
  "debug":{
    "rawquerystring":"origin:*",
    "querystring":"origin:*",
    "parsedquery":"origin:*",
    "parsedquery_toString":"origin:*",
    "QParser":"LuceneQParser"
  }
}

This is a regression discovered while testing out staging branch for the 2023, 2 SAGE sprint.

Type of change

How Has This Been Tested?

Checklist:

coveralls commented 1 year ago

Coverage Status

Coverage: 45.825% (-0.008%) from 45.833% when pulling f9e8ede1888b689a9ceb872d526b78c02812f00d on regression_in_search into 92ac6e05c9f03e742ad78dba6e8c4e6c092bf2d8 on staging.