FAQ
Hi there,

I am trying to do a search on multiple terms inclusive using boosting. I
extended the MultiFieldQueryParser like this:

public static org.apache.lucene.search.Query parse(String query, String[]
fields, float[] boost,
Analyzer analyzer)
throws ParseException
{
BooleanQuery bQuery = new BooleanQuery();
for (int i = 0; i < fields.length; i++)
{
org.apache.lucene.search.Query q = parse(query, fields[i],
analyzer);
q.setBoost(boost[i]);
bQuery.add(q, false, false);
}
return bQuery;
}

It works fine for single term i.e searching for 'dvd' results in:

name:dvd^6.0 shortDescription:dvd^4.0 longDescription:dvd^2.0

But, if I have multiple term like 'dvd player' I get:

(name:dvd name:player) (mfName:dvd mfName:player) (shortDescription:dvd
shortDescription:player) (longDescription:dvd longDescription:player)

Any ideas?

Cheers, Martin


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

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupjava-user @
categorieslucene
postedMar 5, '03 at 10:24p
activeMar 5, '03 at 10:24p
posts1
users1
websitelucene.apache.org

1 user in discussion

Martin Rademacher: 1 post

People

Translate

site design / logo © 2022 Grokbase