Search code examples
solrlucene

How to query exactly keywords with position in Solr Apache


Is there any way to query exactly keywords with position in Solr Apache. Ex I have document with summary is :

"Robert 1988 and Christian 1986"

Then I query keyword : ("Christian" 1988). It must be return 0 result. But It still return the record above. Please help me.


Solution

  • By default solr applies "OR" operator while querying, meaning that for query -

    summary: Christian 1988

    Internally query is translated as - summary:Christian OR default search field:1988 hence you are getting the results

    For querying exact phrases, you can use double quotes around your phrase like - summary: "Christian 1988"

    This should return you 0 results.