FAQ
Dear Lucene Users,

Is there a way or has someone been able to implement an ordered proximity search. Lucene currently uses the "word1 word2"~5 query to find tokens that are within 5 words of each other in any order. What I've been asked to do is find only the results that are for instance within 5 words of each other in the order the query was written.

For a scenario like


text:"blah blah blah. Section 1 of Primary Act 1976, s1. Dogs Act 1999, s3 blah blah blah"


Say I wanted to find the Dogs Act Section 1 using text:"dogs act s1"~5 query would give the above record when it wasn't in context. This is the reason for wanting results in order to stop these incorrect results.


Any help would be greatly appreciated.

R
Adam



_________________________________________________________________
Be one of the first to try Windows Live Mail.
http://ideas.live.com/programpage.aspx?versionId=5d21c51a-b161-4314-9b0e-4911fb2b2e6d
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org

Search Discussions

  • Erik Hatcher at Nov 21, 2006 at 9:42 am

    On Nov 20, 2006, at 11:20 PM, Adam wrote:
    Dear Lucene Users,

    Is there a way or has someone been able to implement an ordered
    proximity search. Lucene currently uses the "word1 word2"~5 query
    to find tokens that are within 5 words of each other in any order.
    What I've been asked to do is find only the results that are for
    instance within 5 words of each other in the order the query was
    written.
    Yup... SpanNearQuery supports ordered and unordered proximity.
    PhraseQuery does not, though. QueryParser will only create a
    PhraseQuery though, so you'll need to subclass QueryParser to add
    this functionality. There is an example of this in the free code of
    Lucene in Action - http://www.lucenebook.com

    Erik

    For a scenario like


    text:"blah blah blah. Section 1 of Primary Act 1976, s1. Dogs Act
    1999, s3 blah blah blah"


    Say I wanted to find the Dogs Act Section 1 using text:"dogs act
    s1"~5 query would give the above record when it wasn't in context.
    This is the reason for wanting results in order to stop these
    incorrect results.


    Any help would be greatly appreciated.

    R
    Adam



    _________________________________________________________________
    Be one of the first to try Windows Live Mail.
    http://ideas.live.com/programpage.aspx?versionId=5d21c51a-
    b161-4314-9b0e-4911fb2b2e6d
    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org

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

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupjava-user @
categorieslucene
postedNov 21, '06 at 9:10a
activeNov 21, '06 at 9:42a
posts2
users2
websitelucene.apache.org

2 users in discussion

Adam: 1 post Erik Hatcher: 1 post

People

Translate

site design / logo © 2022 Grokbase