lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ash nix <>
Subject counting spans through spanquery.
Date Fri, 08 Mar 2013 16:55:52 GMT

Following is brief description of what I want to do.
Search for Phrase query in index. Phrases are two to four terms at max.
Scoring of the documents is based on the number of occurrence of
phrase in a document.
Following is my approach.

1. Construct a SpanNearQuery from the terms in phrase with slop of 1
distance between the terms.
2. Wrap the spannearquery from above in a ConstantScoreQuery.
3. Search the index with the constantscorequery created above.
4. Now go over each document using and the count
the number of spans in the document.
    Score the document based on the count.
5. Save the doc identifier and score in a Map.

Is there more efficient way to do this?
Step 4 will make things slow and I don't like creating a map in step 5
to save the score.
Can I set the score in some other lucene structure?

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message