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