lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alessandro Benedetti <abenede...@apache.org>
Subject Re: search for documents where all words of field present in the query
Date Wed, 18 Nov 2015 14:28:55 GMT
Assuming this is the only, specific kind of search you want, what about
using shingles of tokens at query time and keyword tokenizer at indexing
time ?

Ideally you don't tokenise at indexing time.
At query time you build your shingles ( apparently you need not only
adiacent token shingles, so play a little bit with it and possibly
customise it) .

If you give us more information, maybe we can design a better solution.

Cheers


On 18 November 2015 at 09:02, Ahmet Arslan <iorixxx@yahoo.com.invalid>
wrote:

>
>
> 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 <mail@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.
>



-- 
--------------------------

Benedetti Alessandro
Visiting card : http://about.me/alessandro_benedetti

"Tyger, tyger burning bright
In the forests of the night,
What immortal hand or eye
Could frame thy fearful symmetry?"

William Blake - Songs of Experience -1794 England

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message