lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ching-Pei Hsing <>
Subject Need help in changing the search score
Date Tue, 11 Mar 2003 03:11:20 GMT

Can somebody help us to figure out how to build queries (or tune Lucene) to
return the result in a specific order? When search against multiple fields,
It seems like Lucene will give partial matching in multiple fields higher
score than better matching in a single field. Take the following as an

		Name: "Comfort Inn Shampoo"
		Manufacture Model Number (MMNUM): "XXXX"
		Supplier Model Number (SMNUM): "YYYY"

		Name: "Inn xxxx yyyy"
		Manufacture Model Number (MMNUM): "Inn aaaa bbbb"
		Supplier Model Number (SMNUM): "Inn cccc dddd"

If we enter the search term "comfort inn shampoo" to search against all
three fields "Name", "Manufacture Model Number" and "Supplier Model Number",
Product2 will come back on top of Product1 because "Inn" is partially
matched in 3 fields in Product2, even though Name is a perfect match in
Product1. What we really want is to some how give Product1 higher score than

The query issued is like the following (The queries are generated
programmatically and the booster is put by calling "setBoost" on the Query

query = (NAME:inn NAME:comfort NAME:shampoo) (MMNUM:inn MMNUM:shampoo
MMNUM:comfort) (SMNUM:shampoo SMNUM:comfort SMNUM:inn)

Even if we boost the Name by 10 like the following query, It's still the

query = (NAME:inn NAME:comfort NAME:shampoo)^10 (MMNUM:inn MMNUM:shampoo
MMNUM:comfort) (SMNUM:shampoo SMNUM:comfort SMNUM:inn)

Is there any thing we can do to make better matching in a single fields earn
higher score than partial matching in several fields?

Any help would be greatly appreciated.


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

View raw message