lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sol myr <>
Subject PhraseQuery with huge slop?
Date Wed, 06 Apr 2011 19:12:03 GMT

I need to run and "AND" query, with a twist: giving higher ranking for
"exact match".
So when searching for  BIG BEN
- Give high rank for the Document  "BIG BEN is in London"
 - Lower rank for  "It's a BIG day for my dear friend BEN"

Following good advice from this list (thanks!), I used 2 separate
queries (the query "+BIG +BEN"  and the exact-phrase "BIG BEN").
Ending up with:
Query andQ=parser.parse("+big +ben");
Query phraseQ=parser.parse("\"big ben\"");
phraseQ.setBoost(5); // Prioritize exact match
// Combined main query:
BooleanQuery main=new BooleanQuery();
main.add(andQ, SHOULD);
main.add(phraseQ, SHOULD);

This works, but someone suggested an alternative: PhraseQuery with a very
large SLOP (to cover the entire document lenght).
Is this recommended? Does a large SLOP damage performance?
My documents currently have just several *hundreds* of words (but I'm
curious whether it will scale for *thousands* of words).

Thanks :)

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message