Hi Robert,

it looks really good!
Many thanks!

Regards,
Livia


-----Ursprüngliche Nachricht-----
Von: "Robert Muir" <rcm...@gmail.com>
Gesendet: 16.01.2011 18:50:36
An: java-user@lucene.apache.org
Betreff: Re: how to implement a proximity search feature using Queries instead 
of terms

>On Sun, Jan 16, 2011 at 12:42 PM, Livia Hauser <livia.hau...@web.de> wrote:
>> Hi All,
>>
>> i have my own query parser which generates fuzzy/wildcard queries instances. 
>> It works fantastic, Lucene rocks ;-).
>> But i have to make sure the words are not to far apart.  I checked current 
>> proximity implementation. What i found is: PhraseQuery calculates a distance 
>> between terms (no fuzzy logic possible).
>> I have to calculate the distance (proximity) on the base of fuzzy queries.
>>
>> Somebody  a idea how i can implement this feature?
>>
>> Short example:
>> indexed string: "left word a b c d e f other right"
>> query string (fuzzy 0.5): "ohter word"
>> expected distance: 6
>>
>
>I think you can do this with lucene's stable branch (what should be
>our next 3.1 release):
>http://svn.apache.org/repos/asf/lucene/dev/branches/branch_3x/
>
>Have a look at SpanMultiTermQueryWrapper: it allows you to rewrite any
>MultiTermQuery (such as Fuzzy/Wildcard) into a SpanQuery.
>For example in this case I think you would do:
>
>FuzzyQuery f1 = new FuzzyQuery(new Term("field", "ohter"));
>SpanQuery s1 = new SpanMultiTermQueryWrapper<FuzzyQuery>(f1);
>
>FuzzyQuery f2 = new FuzzyQuery(new Term("field", "word"));
>SpanQuery s2 = new SpanMultiTermQueryWrapper<FuzzyQuery>(f2);
>
>Now you can put the two spanqueries (s1 and s2) into a SpanNearQuery,
>and specify the maximum slop, and if they are required to be in order
>or not, etc etc.
>
>For more examples see the unit test:
>http://svn.apache.org/repos/asf/lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/search/spans/TestSpanMultiTermQueryWrapper.java
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org
>For additional commands, e-mail: java-user-h...@lucene.apache.org
>
___________________________________________________________
Empfehlen Sie WEB.DE DSL Ihren Freunden und Bekannten und wir
belohnen Sie mit bis zu 50,- Euro! https://freundschaftswerbung.web.de

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org
For additional commands, e-mail: java-user-h...@lucene.apache.org

Reply via email to