On Saturday, November 22, 2003, at 06:33 PM, Dion Almaer wrote:
3. I have some fields suck as title, owner, etc as well as the content blob which I index and use as
the default search field. Is there an easy way to extend the QueryParser to merge it with a
MultiTermQuery which can also search this meta data and give them certain weights? Or, if you go
down this path do you have to leave the QueryParser behind and build your own queries? Any best
practices would be great.

And Ype said:
You can provide field weights at document indexing time (norms) and use a
MultiTermQuery for searching multiple fields. At query time you can
again use field weights.
I don't know how the scoring of the MultiTermQuery is done,
it might use the max. score over the fields of a document, or combine the
scores in the fields of a document.
---- end Ype's reply cut and paste


I'm a little confused with this question and Ype's reply. MultiTermQuery is an abstract base class under Query, which is the parent for WildcardQuery and FuzzyQuery.

What I think you're after is using MultiFieldQueryParser, but you want to weight the fields differently. You can add the boosts at indexing time using Field.setBoost. Unfortunately at the moment MultiFieldQueryParser is not very extensible - there are some open issues with its subclassability but subclassing MFQP and overriding getFieldQuery will do the trick when the subclassing issues are resolved allowing you to boost at query time.

Making an educated guess at what you're doing with Lucene, Dion, I'd venture to say that boosting at indexing time is sufficient for your needs.

Erik



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to