[ 
https://issues.apache.org/jira/browse/LUCENE-3347?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13072239#comment-13072239
 ] 

Uwe Schindler commented on LUCENE-3347:
---------------------------------------

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
>            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.
> <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>
> 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:
> q.setBoost(DOMUtils.getAttribute(e,"boost",1.0f));
> to:
> q.setBoost( DOMUtils.getAttribute( e, "boost", q.getBoost() ) );

--
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

Reply via email to