lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Boris Goldowsky <bo...@alum.mit.edu>
Subject Re: Result scoring question
Date Thu, 15 Apr 2004 12:29:23 GMT
On Wednesday 14 April 2004 20:55, Armbrust, Daniel C. wrote:

> > Is there anything that I can do in my query construction, to ensure that if
> > a query exactly matches a document, it will be the top result?

I know of two methods (and would be happy to hear comments or
additions):

1) index the field as a Keyword.  The only result of querying this will
be exact (character-by-character identical) matches.  You can index the
field both as Keyword and as Text if you wish, and construct a query
that attempts both the exact and inexact match, with appropriate
weights.

2) A bit of a hack perhaps, but effective: index the field as "zgzgl
text of field zgzgl", and query for the phrase "zgzgl text of query
zgzgl".  "zgzgl" here stands for some token that doesn't otherwise occur
in your data.  Any matches to this phrase, then, are guaranteed to be
matches to complete document fields, but with accommodation for
stopwords, stemming, or whatever your Analyzer does.  Add slop to the
phrase query if you wish, and again, you can attach appropriate weights
to this and combine with other techniques.

Boris
-- 
Boris Goldowsky
boris@alum.mit.edu
www.goldowsky.com/consulting


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


Mime
View raw message