0
  1. 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]

  2. 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.

1 Answer 1

1

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"]
Sign up to request clarification or add additional context in comments.

4 Comments

Both are used as filter queries[Multiple filters].Is it possible to use them both in fq and make it work? Thanks in advance.
yes, SOLR (>4.5) supports, fq=(field1:value1 OR field2:value2). you can use q=mainQuery(*:*)&fq=({!complexphrase inOrder=true}employeeName_t:"Mike R*" AND empDate_dt:["2016-10-10T00:00:00Z" TO "2016-10-10T23:59:59Z"] )
change main query q and operator accordingly.
There seems to be some problem with date alone.Your query works fine with string,text fields and even integer fields,if given in the second part after complex query.Just not with date.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.