Index: lucene/contrib/xml-query-parser/src/java/org/apache/lucene/xmlparser/builders/UserInputQueryBuilder.java
===================================================================
--- lucene/contrib/xml-query-parser/src/java/org/apache/lucene/xmlparser/builders/UserInputQueryBuilder.java (revision 1152378)
+++ lucene/contrib/xml-query-parser/src/java/org/apache/lucene/xmlparser/builders/UserInputQueryBuilder.java (working copy)
@@ -74,7 +74,8 @@
QueryParser parser=createQueryParser(fieldName, analyzer);
q = parser.parse(text);
}
- q.setBoost(DOMUtils.getAttribute(e,"boost",1.0f));
+ // use the boost of the original query here, too and multiply (which may be != 1.0f):
+ q.setBoost(q.getBoost()*DOMUtils.getAttribute(e,"boost",1.0f));
return q;
} catch (ParseException e1) {
throw new ParserException(e1.getMessage());
Index: lucene/contrib/xml-query-parser/src/test/org/apache/lucene/xmlparser/TestParser.java
===================================================================
--- lucene/contrib/xml-query-parser/src/test/org/apache/lucene/xmlparser/TestParser.java (revision 1152378)
+++ lucene/contrib/xml-query-parser/src/test/org/apache/lucene/xmlparser/TestParser.java (working copy)
@@ -121,6 +121,7 @@
public void testCustomFieldUserQueryXML() throws ParserException, IOException
{
Query q=parse("UserInputQueryCustomField.xml");
+ assertEquals(20.0f, q.getBoost());
int h = searcher.search(q, null, 1000).totalHits;
assertEquals("UserInputQueryCustomField should produce 0 result ", 0,h);
}
Index: lucene/contrib/xml-query-parser/src/test/org/apache/lucene/xmlparser/UserInputQueryCustomField.xml
===================================================================
--- lucene/contrib/xml-query-parser/src/test/org/apache/lucene/xmlparser/UserInputQueryCustomField.xml (revision 1152378)
+++ lucene/contrib/xml-query-parser/src/test/org/apache/lucene/xmlparser/UserInputQueryCustomField.xml (working copy)
@@ -1,2 +1,2 @@
-Bank
+Bank^2