Hi Jim,

I think you could do some magic with function queries.
https://cwiki.apache.org/confluence/display/solr/Function+Queries


Index number of unique words in the product title e.g.
title = john smith
length = 2

return products if the number of matching terms equals to the number of words 
in the title.

Perhaps there is a better way but something like below should work in theory.

termfreq(title,'john') 
termfreq(title,'smith')

fq={!frange l=0 u=0} sub(length, sum(termfreq(title,'smith'), 
termfreq(title,'smith')))
Ahmet


On Tuesday, November 17, 2015 4:31 PM, superjim <m...@tevel.info> wrote:



How would I form a query where all of the words in a field must be present in
the query (but possibly more). For example, if I have the following words in
a text field: "John Smith"

A query for "John" should return no results

A query for "Smith" should return no results

A query for "John Smith" should return that one result

A query for "banana John Smith purple monkey dishwasher" should return that
one result





--
View this message in context: 
http://lucene.472066.n3.nabble.com/search-for-documents-where-all-words-of-field-present-in-the-query-tp4240564.html
Sent from the Solr - User mailing list archive at Nabble.com.

Reply via email to