0
votes

I have a Lucene indexed corpus of more than 1 million documents. I am searching for named entities such as "Susan Witting" by using the the Lucene java API for queries. I would like to expand my queries by also searching for "Sue Witting" for example but would like that term to have a lower weight than the main query term.

How can I go about doing that? I found infos about the boosting option in the Lucene Manual. But it seems to be set at indexing and it needs fields.

2

2 Answers

3
votes

You can boost each query clause independently. See the Query Javadoc.

0
votes

If you want to give different weight to the words of a term. Then

Query#setBoost(float)

is not useful. A better way is:

Term term = new Term("some_key", "stand^3 firm^2 always");

This allows to give different weight to words in the same term query. Here, the word stand boosted by three but always is has the default boost value.