[ 
https://issues.apache.org/jira/browse/LUCENE-3347?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Uwe Schindler updated LUCENE-3347:
----------------------------------

    Description: 
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}



  was:
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() ) );





> 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

Reply via email to