: 
: if user searches for "swingline red stapler hammer hand rigid", then
: documents that matches max number of words written in query should come
: first
: e.g a document with name field as "swingline stapler" should come later than
: the document with "swingline red stapler"

at a fundemental level, Lucene searches already work this way.

A "BooleanQuery" containing 6 optional clauses from "swingline red stapler 
hammer hand rigid" will have a coord factor of 3/6 against a document with 
the value "swingline red stapler" and a coord factor of 2/6 against a 
document with the value "swingline stapler"

that said: other factors come into play: notable the fieldNorm,which 
by default gives higher scores to shorter documents.  IDF and TF also come 
into play typically, but in your example they shouldn't affect much since 
the query doesn't change and the documents only contain ech term at most 
once.

Bottom line: you need to look atthe score explanations to understand why 
documents aren't showing up in the order that you want, and then you need 
to consider what settings you chan change to get hte behavior you want 
(ie: perhaps you need to omitNorms so shorter fields don't get a boost?)

With out seeing your score explanations, we're just guessing at things 
that might help.

--
http://lucenerevolution.org/  ...  October 7-8, Boston
http://bit.ly/stump-hoss      ...  Stump The Chump!

Reply via email to