Reputation: 3
When I search in Solr 4.0 with the following two filter queries separately, it works as expected.
{!complexphrase inOrder=true}employeeName_t:"Mike R*"
empDate_dt:[2016-10-10T00:00:00Z TO 2016-10-10T23:59:59Z]
But I am not getting proper search results when I combine these two queries(Irrespective of the order).
{!complexphrase inOrder=true}employeeName_t:"Mike R*" AND empDate_dt:[2016-10-10T00:00:00Z TO 2016-10-10T23:59:59Z]
This query gives me zero search results in Solr
"response": { "numFound":0, "start":0, "maxScore":0, "docs":[] }
empDate_dt:[2016-10-10T00:00:00Z TO 2016-10-10T23:59:59Z] AND {!complexphrase inOrder=true}employeeName_t:"Mike R*"
Whereas change in query order gives me parse exception as follows
"error":{ "msg": "org.apache.solr.search.SyntaxError: org.apache.lucene.queryparser.classic.ParseException: Cannot parse 'employeeName_t:\"Mike': Lexical error at line 1, column 21. Encountered: after : \"\\"Mike\"",code:400 }
Using ComplexPhraseQueryParser for partial search in solr.Need to use both queries.Any suggestions to this would be greatly appreciated.
Upvotes: 0
Views: 1510
Reputation: 1953
I suggest you to use fq parameter.
docs are retrieved with query as :"Mike R*" and filtered with dates specified in fq parameter.
Example:
q={!complexphrase inOrder=true}employeeName_t:"Mike R*"&fq=empDate_dt:["2016-10-10T00:00:00Z" TO "2016-10-10T23:59:59Z"]
Upvotes: 1