From 12fb9eda87508affa3a601e1ad955951798c25f1 Mon Sep 17 00:00:00 2001 From: Alan Woodward Date: Mon, 3 Aug 2015 16:53:55 +0000 Subject: [PATCH] LUCENE-6706: Commit from the right directory this time git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1693933 13f79535-47bb-0310-9956-ffa450edef68 --- lucene/CHANGES.txt | 3 +++ .../xml/builders/BoostingTermBuilder.java | 12 +++++++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txt index 0b6c4e3c60e..22588f784e2 100644 --- a/lucene/CHANGES.txt +++ b/lucene/CHANGES.txt @@ -40,6 +40,9 @@ API Changes abstract and has no reflection-based default implementation anymore. (Uwe Schindler) +* LUCENE-6706: PayloadTermQuery and PayloadNearQuery have been removed. + Instead, use PayloadScoreQuery to wrap any SpanQuery. (Alan Woodward) + ======================= Lucene 5.3.0 ======================= New Features diff --git a/lucene/queryparser/src/java/org/apache/lucene/queryparser/xml/builders/BoostingTermBuilder.java b/lucene/queryparser/src/java/org/apache/lucene/queryparser/xml/builders/BoostingTermBuilder.java index eb920b1d1b3..4d4b3c8e1d8 100644 --- a/lucene/queryparser/src/java/org/apache/lucene/queryparser/xml/builders/BoostingTermBuilder.java +++ b/lucene/queryparser/src/java/org/apache/lucene/queryparser/xml/builders/BoostingTermBuilder.java @@ -1,11 +1,12 @@ package org.apache.lucene.queryparser.xml.builders; import org.apache.lucene.index.Term; -import org.apache.lucene.search.payloads.AveragePayloadFunction; -import org.apache.lucene.search.payloads.PayloadTermQuery; -import org.apache.lucene.search.spans.SpanQuery; import org.apache.lucene.queryparser.xml.DOMUtils; import org.apache.lucene.queryparser.xml.ParserException; +import org.apache.lucene.search.payloads.AveragePayloadFunction; +import org.apache.lucene.search.payloads.PayloadScoreQuery; +import org.apache.lucene.search.spans.SpanQuery; +import org.apache.lucene.search.spans.SpanTermQuery; import org.w3c.dom.Element; /* @@ -26,7 +27,7 @@ import org.w3c.dom.Element; */ /** - * Builder for {@link PayloadTermQuery} + * Builder for {@link PayloadScoreQuery} */ public class BoostingTermBuilder extends SpanBuilderBase { @@ -35,7 +36,8 @@ public class BoostingTermBuilder extends SpanBuilderBase { String fieldName = DOMUtils.getAttributeWithInheritanceOrFail(e, "fieldName"); String value = DOMUtils.getNonBlankTextOrFail(e); - PayloadTermQuery btq = new PayloadTermQuery(new Term(fieldName, value), new AveragePayloadFunction()); + PayloadScoreQuery btq = new PayloadScoreQuery(new SpanTermQuery(new Term(fieldName, value)), + new AveragePayloadFunction()); btq.setBoost(DOMUtils.getAttribute(e, "boost", 1.0f)); return btq; }