Is your requirement specifying that none of the alternative results should be shown if there are any primary results, or that the primary results should be shown first, or that both are acceptable?

You could do a phrase query for the full list of terms, and then do a second query with OR if the first returns no results.

Or, you could use a boost on the phrase and OR it with a de-boosted parenthesized OR query of the individual terms to show both but with the phrase matches first. If the natural scoring doesn't already boost the phrases enough by default.

You could also do that second approach by simply using the edismax query parser with the pf parameter to boost the phrase of all terms.

-- Jack Krupansky

-----Original Message----- From: PAVAN
Sent: Wednesday, September 25, 2013 9:12 AM
To: solr-user@lucene.apache.org
Subject: AND/OR logic

Hi,

    I have situation that if user enters any string to search then i need
to display the results in the following way.

1. It has to match exact string what he entered.

             (or)

2. It has to split the string and search for individual keywords(for every
string) and it has to display the results.

Ex : suppose user searching for

        "royal enfeild bikes"

First Condition----it has to check for whole string "royal enfiled bikes"
Second Condition ----- it has to display the results like   royal OR enfiled
OR bikes

Can anyone give me suggestions.










--
View this message in context: http://lucene.472066.n3.nabble.com/AND-OR-logic-tp4091931.html Sent from the Solr - User mailing list archive at Nabble.com.

Reply via email to