FAQ
Hi,

Following up a related post I made on lucene-user yesterday, I've
tracked down what I consider to be a bug in the Query parser relating to
boosting boolean queries.

In short, I think it's reasonable for a user to want to boost all the
terms within a set of parentheses like this:

(fred jim bob)^2.0

However, this fails with the current query parser - the boost factor is
silently ignored.

Please find attached a patch that adds two assertions to the query
parser test, demonstrating the above problem. The patch also includes a
minor change to QueryParser.jj to fix the problem and a tweak to
BooleanQuery.toString() to help test it.

Regards,

--
Lee Mallabone.
Granta Design Ltd.

Search Discussions

  • Doug Cutting at Sep 6, 2002 at 7:10 pm
    This fixes the query parser, but, unfortunately, the problem is deeper.
    BooleanQuery does not implement boosting. This could be fixed too,
    but, for now, the easiest thing to do is simply to boost each term
    within the boolean query.

    Doug


    --
    To unsubscribe, e-mail:
    For additional commands, e-mail:
  • Lee Mallabone at Sep 9, 2002 at 8:11 am

    On Fri, 2002-09-06 at 20:11, Doug Cutting wrote:
    This fixes the query parser, but, unfortunately, the problem is deeper.
    BooleanQuery does not implement boosting. This could be fixed too,
    but, for now, the easiest thing to do is simply to boost each term
    within the boolean query.
    Ah. That *would* explain why further tests I made on a real index looked
    like no weighting was occuring on boolean query rankings! :)

    Should I update the patch for now so that BooleanQuery.setBoost() just
    calls setBoost() on all its clauses?

    Regards,

    --
    Lee Mallabone.


    --
    To unsubscribe, e-mail:
    For additional commands, e-mail:
  • Doug Cutting at Sep 11, 2002 at 10:28 pm

    Lee Mallabone wrote:
    Should I update the patch for now so that BooleanQuery.setBoost() just
    calls setBoost() on all its clauses?
    That only works if you call setBoost() after all of the clauses have
    been added, which is a little fragile. So you'd also need to boost new
    clauses as they're added. Also, what happens when a clause already has
    a boost that's not equal to 1? Should setBoost() then set each clause's
    boost to the product of its current boost and the supplied boost?

    So yes, its possible to fix this way, if a little complex. Things would
    be simpler if BooleanQuery just multiplied its boost into the scores.

    Doug


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

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupdev @
categorieslucene
postedSep 6, '02 at 9:54a
activeSep 11, '02 at 10:28p
posts4
users2
websitelucene.apache.org

2 users in discussion

Doug Cutting: 2 posts Lee Mallabone: 2 posts

People

Translate

site design / logo © 2021 Grokbase