Hi Grant,
    I have an index for articles containing fields 'id' , 'body' and others

BooleanQuery query = new BooleanQuery;
queryParser = new QueryParser("body", new StandardAnalyzer());
query.add(queryParser.parse("keywords"), Occur.MUST);

if i query at this level then i get all the articles I want. But I want to
de-boost some of them if they matches another term
.
BooleanQuery q1 = new BooleanQuery;
BooleanQuery q2 = new BooleanQuery;
queryParser = new QueryParser("body", new StandardAnalyzer());
q1.add(queryParser.parse("body"), Occur.SHOULD);
queryParser = new QueryParser("some field", new StandardAnalyzer());
q2.add(queryParser.parse("keywords2"), Occur.SHOULD);

q1.setBoost(0.1);
q2.setBoost(0.3);
query.add(q1, Occur.SHOULD);
query.add(q2, Occur.SHOULD);
### what I want here is that any document matching the queries q1 and q2
will be boosted negatively(reducing their score but *not eliminating from
the search result*)
# puting values less than 1.0 (as I tried doing) did not help (lucene seems
to assume it as 1)
# if there was only one query then I could do it as I wrote in my last mail.
But the problem is when there a multiple queries to reduce the score by
multiple levels.

or am I going in a wrong direction?? It wud be nice if you have some
suggestion.

Prabin

On Feb 1, 2008 6:32 PM, Grant Ingersoll <[EMAIL PROTECTED]> wrote:

> Hi Prabin,
>
> Can you give an example of what you would like a query to look like?
> Lucene doesn't do negative boosts (ok, w/ a patch, I think it can,
> but...)  At any rate, the boosts are relative, so perhaps you just
> lower the boost to be very small for the "bad" terms and raise it
> higher for the good terms.
>
> What is the end goal of what you are trying to find?  Perhaps there
> are some alternatives.
>
> -Grant
>
> On Jan 31, 2008, at 2:49 PM, prabin meitei wrote:
>
> > Hi,  I want to give different levels of negative boost (reduce the
> > score) to
> > documents for different matching queries. How it can be done??
> > Googling I
> > found out this link
> > http://wiki.apache.org/jakarta-lucene/CommunityContributions  but
> > it just
> > gives the option of giving single level negative boost.
> > is there any way of having multiple matching queries and give them
> > different
> > negative boosts???
> >
> >
> > Regards,
> > Prabin
>
> --------------------------
> Grant Ingersoll
> http://lucene.grantingersoll.com
> http://www.lucenebootcamp.com
>
> Lucene Helpful Hints:
> http://wiki.apache.org/lucene-java/BasicsOfPerformance
> http://wiki.apache.org/lucene-java/LuceneFAQ
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

Reply via email to