The PositionFilter worked great for my purpose along with another filter that I build.
In my case, my indexed data may be something like "X150". So, a query for "Nokia X150" should match. But I don't want random matches on "x". However, if my indexed data is "G7", I do want a query on "PowerShot G7" to match on "g" and "7". So, a simple length filter will not do. Instead I build a custom filter (that I am willing to contribute back) that filters out singletons that are surrounded by longer tokens (3 or more by default). So, "PowerShot G7" becomes "power" "shot" "g" "7", but "Nokia X150" becomes "nokia" "150". And then I put the results of this into a PositionFilter. This allows "Nokia X150ABC" to match against the "X150" part. So far I really like this for partial part number searches. And then to boost exact matches, I used copyField to create another field without PositionFilter. And then did an optional phrase query on that. ________________________________ From: Lance Norskog <goks...@gmail.com> To: solr-user@lucene.apache.org Sent: Wed, February 17, 2010 7:23:23 PM Subject: Re: parsing strings into phrase queries That would be great. After reading this and the PositionFilter class I still don't know how to use it. On Wed, Feb 17, 2010 at 12:38 PM, Robert Muir <rcm...@gmail.com> wrote: > i think we can improve the docs/wiki to show this example use case, i > noticed the wiki explanation for this filter gives a more complex shingles > example, which is interesting, but this seems to be a common problem and > maybe we should add this use case. > > On Wed, Feb 17, 2010 at 1:54 PM, Chris Hostetter > <hossman_luc...@fucit.org>wrote: > >> >> : take a look at PositionFilter >> >> Right, there was another thread recently where almost the exact same issue >> was discussed... >> >> http://old.nabble.com/Re%3A-Tokenizer-question-p27120836.html >> >> ..except that i was ignorant of the existence of PositionFilter when i >> wrote that message. >> >> >> >> -Hoss >> >> > > > -- > Robert Muir > rcm...@gmail.com > -- Lance Norskog goks...@gmail.com