[ https://issues.apache.org/jira/browse/LUCENE-3347?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13072239#comment-13072239 ]
Uwe Schindler edited comment on LUCENE-3347 at 7/28/11 7:54 AM: ---------------------------------------------------------------- That's indeed a bug, your workaround is the correct fix. In my opinion, the original query's boost should be multiplied, else it makes it impossible on the other hand to modify the final score by a boost attribute: {code:java} q.setBoost(q.getBoost() * DOMUtils.getAttribute(e, "boost", 1.0f)); {code} So {noformat} <UserQuery fieldName="Vehicle.Colour" boost="2.0">black^0.01</UserQuery> {noformat} would produce a boost of 0.02. This is especially important for combined queries. You bug does not occur for the first clauses, as the userquery nodes produce itsself a BooleanQuery, but with boost 1.0 on top-level (see the additional brackets). But the fix behaves identical here. was (Author: thetaphi): That's indeed a bug, your workaround is the correct fix. In my opinion, the original query's boost should be multiplied, else it makes it impossible on the other hand to modify the final score by a boost attribute: {code:java} q.setBoost(q.getBoost() * DOMUtils.getAttribute(e, "boost", 1.0f)); {code} So {noformat} <UserQuery fieldName="Vehicle.Colour" boost="2.0">black^0.01</UserQuery> {noformat} would produce a boost of 0.02. This is especially important for combined queries. You bug occurs because for the first clauses, the userquery nodes produce itsself a BooleanQuery, but with boost 1.0 on top-level. So the fix behaves identical here. > XMLparser drops user boosting > ----------------------------- > > Key: LUCENE-3347 > URL: https://issues.apache.org/jira/browse/LUCENE-3347 > Project: Lucene - Java > Issue Type: Bug > Affects Versions: 3.1 > Reporter: moogie > Assignee: Uwe Schindler > Priority: Minor > Fix For: 3.4, 4.0 > > Original Estimate: 1h > Remaining Estimate: 1h > > The lucene XML parser seems to convert user defined boosting back to default > 1.0 and thus boosting value is dropped from the query... > e.g. > {code:xml} > <BooleanQuery> > <Clause occurs="must"> > <BooleanQuery> > <Clause occurs="should"> > <UserQuery fieldName="Vehicle.Colour">red^66 > blue~^8</UserQuery> > </Clause> > </BooleanQuery> > </Clause> > <Clause occurs="should"> > <BooleanQuery> > <Clause occurs="should"> > <UserQuery > fieldName="Vehicle.Colour">black^0.01</UserQuery> > </Clause> > </BooleanQuery> > </Clause> > </BooleanQuery> > {code} > produces a lucene query: +( ( Vehicle.Colour:red^66 Vehicle.Colour:blue~0.5^8 > ) ) ( Vehicle.Colour:black ) > The expected query : +( ( Vehicle.Colour:red^66 Vehicle.Colour:blue~0.5^8 ) ) > ( Vehicle.Colour:black^0.01 ) > I have developed a work around by modifying line 77 of > UserInputQueryBuilder.java > from: > {code:java} > q.setBoost(DOMUtils.getAttribute(e,"boost",1.0f)); > {code} > to: > {code:java} > q.setBoost( DOMUtils.getAttribute( e, "boost", q.getBoost() ) ); > {code} -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org For additional commands, e-mail: dev-h...@lucene.apache.org