But neither "best" nor "restaurant" are in any of the documents, so how are
any of these documents reasonable matches?
You have the semantics of query backwards. The documents are the "data" and
the query is the "operation" to be performed on the data. The intent of a
query is to specify what documents should be selected. That is the
function/purpose of any query, in any search system.
-- Jack Krupansky
-----Original Message-----
From: SR
Sent: Saturday, November 03, 2012 5:09 PM
To: solr-user@lucene.apache.org
Subject: Re: All document keywords must match the query keywords
On 2012-11-03, at 12:55 PM, Gora Mohanty wrote:
On 3 November 2012 22:17, SR <r.steve....@gmail.com> wrote:
Solr 4.0
I need to return documents when all their keywords are matching the
query.
In other words, all the document keywords should match the query keywords
e.g., query: best chinese food restaurant
doc1: chinese food
doc2: italian food
doc3: chinese store
Only doc1 should be returned ("chinese food" is matching the query).
Any idea on how this can be achieved?
Not sure what you mean by all the keywords should match, given your
examples above. doc2 will match because of "food" and doc3 will match
because of "chinese".
If you really want all search terms to be matched, you can change the
default operator for solrQueryParser in schema.xml from OR to AND,
but in your example even doc1 will not match as you are searching
for "best chinese food restaurant". If you searched for "chinese food"
it would match.
Regards,
Gora
Hi Gora,
I really meant that. doc 2 shouldn't match because "italian" is not in the
query. Same thing for doc3 with "store". It's like applying an AND but on
the document keywords, instead of the query keywords.
Thanks,
-S=