Proximity searching in rdig ferret


#1

Lucene has a syntax “foo bar”~10 for finding foo within 10 words of bar.

Does ferret support this feature? (the ~ is used for fuzzy queries) Does
rdig?

This could be a deal breaker for me 'cos I really need proximity
searches


#2

Of course it works - stupid boy!

Ed Ed wrote:

Lucene has a syntax “foo bar”~10 for finding foo within 10 words of bar.

Does ferret support this feature? (the ~ is used for fuzzy queries) Does
rdig?

This could be a deal breaker for me 'cos I really need proximity
searches


#3

Lucene has a syntax “foo bar”~10 for finding foo within 10 words of bar.

sure … take a look at this (take from the API):

–snip–
query = SpanNearQuery.new(:slop => 2)
query << SpanTermQuery.new(:field, “quick”)
query << SpanTermQuery.new(:field, “brown”)
query << SpanTermQuery.new(:field, “fox”)

matches => “quick brown speckled sleepy fox”

                           |______2______^

matches => “quick brown speckled fox”

                            |__1__^

matches => “brown quick _____ fox”

              ^_____2_____|

A SpanNearQuery is like a combination between a PhraseQuery and a
BooleanQuery. It matches sub-SpanQueries which are added as clauses but
those clauses must occur within a slop edit distance of eachother.

http://ferret.davebalmain.com/api/classes/Ferret/Search/Spans/SpanNearQuery.html
–snip–

and even better, you can force the order of the words… the above
example
doesn’t care about the order of the words, but if the order is important
to you, you can build queries that will search for terms in order and a
maximal distance between the words…

look at http://blog.omdb-beta.org/2007/1/16/brad_pitt

Ben


#4

Of course it works - stupid boy!

it’s okay to doubt ferret… sooner or later you will be convinced :wink:

happy ferret’ing …

Ben