|
|
@@ -62,7 +62,7 @@ public abstract class AbstractHighlighterBuilder<HB extends AbstractHighlighterB
|
|
|
public static final ParseField TYPE_FIELD = new ParseField("type");
|
|
|
public static final ParseField FRAGMENTER_FIELD = new ParseField("fragmenter");
|
|
|
public static final ParseField NO_MATCH_SIZE_FIELD = new ParseField("no_match_size");
|
|
|
- public static final ParseField FORCE_SOURCE_FIELD = new ParseField("force_source");
|
|
|
+ public static final ParseField FORCE_SOURCE_FIELD = new ParseField("force_source").withAllDeprecated();
|
|
|
public static final ParseField PHRASE_LIMIT_FIELD = new ParseField("phrase_limit");
|
|
|
public static final ParseField OPTIONS_FIELD = new ParseField("options");
|
|
|
public static final ParseField HIGHLIGHT_QUERY_FIELD = new ParseField("highlight_query");
|
|
|
@@ -87,8 +87,6 @@ public abstract class AbstractHighlighterBuilder<HB extends AbstractHighlighterB
|
|
|
|
|
|
protected Boolean highlightFilter;
|
|
|
|
|
|
- protected Boolean forceSource;
|
|
|
-
|
|
|
protected BoundaryScannerType boundaryScannerType;
|
|
|
|
|
|
protected Integer boundaryMaxScan;
|
|
|
@@ -119,7 +117,6 @@ public abstract class AbstractHighlighterBuilder<HB extends AbstractHighlighterB
|
|
|
highlightQuery = queryBuilder;
|
|
|
order = template.order;
|
|
|
highlightFilter = template.highlightFilter;
|
|
|
- forceSource = template.forceSource;
|
|
|
boundaryScannerType = template.boundaryScannerType;
|
|
|
boundaryMaxScan = template.boundaryMaxScan;
|
|
|
boundaryChars = template.boundaryChars;
|
|
|
@@ -146,7 +143,9 @@ public abstract class AbstractHighlighterBuilder<HB extends AbstractHighlighterB
|
|
|
}
|
|
|
order(in.readOptionalWriteable(Order::readFromStream));
|
|
|
highlightFilter(in.readOptionalBoolean());
|
|
|
- forceSource(in.readOptionalBoolean());
|
|
|
+ if (in.getTransportVersion().before(TransportVersion.V_8_8_0)) {
|
|
|
+ in.readOptionalBoolean(); // force_source, now deprecated
|
|
|
+ }
|
|
|
boundaryScannerType(in.readOptionalWriteable(BoundaryScannerType::readFromStream));
|
|
|
boundaryMaxScan(in.readOptionalVInt());
|
|
|
if (in.readBoolean()) {
|
|
|
@@ -184,7 +183,9 @@ public abstract class AbstractHighlighterBuilder<HB extends AbstractHighlighterB
|
|
|
}
|
|
|
out.writeOptionalWriteable(order);
|
|
|
out.writeOptionalBoolean(highlightFilter);
|
|
|
- out.writeOptionalBoolean(forceSource);
|
|
|
+ if (out.getTransportVersion().before(TransportVersion.V_8_8_0)) {
|
|
|
+ out.writeOptionalBoolean(false);
|
|
|
+ }
|
|
|
out.writeOptionalWriteable(boundaryScannerType);
|
|
|
out.writeOptionalVInt(boundaryMaxScan);
|
|
|
boolean hasBounaryChars = boundaryChars != null;
|
|
|
@@ -527,22 +528,6 @@ public abstract class AbstractHighlighterBuilder<HB extends AbstractHighlighterB
|
|
|
return this.phraseLimit;
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * Forces the highlighting to highlight fields based on the source even if fields are stored separately.
|
|
|
- */
|
|
|
- @SuppressWarnings("unchecked")
|
|
|
- public HB forceSource(Boolean forceSource) {
|
|
|
- this.forceSource = forceSource;
|
|
|
- return (HB) this;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * @return the value set by {@link #forceSource(Boolean)}
|
|
|
- */
|
|
|
- public Boolean forceSource() {
|
|
|
- return this.forceSource;
|
|
|
- }
|
|
|
-
|
|
|
/**
|
|
|
* Set to a non-negative value which represents the max offset used to analyze
|
|
|
* the field thus avoiding exceptions if the field exceeds this limit.
|
|
|
@@ -550,7 +535,7 @@ public abstract class AbstractHighlighterBuilder<HB extends AbstractHighlighterB
|
|
|
@SuppressWarnings("unchecked")
|
|
|
public HB maxAnalyzedOffset(Integer maxAnalyzedOffset) {
|
|
|
if (maxAnalyzedOffset != null && maxAnalyzedOffset <= 0) {
|
|
|
- throw new IllegalArgumentException("[" + MAX_ANALYZED_OFFSET_FIELD.toString() + "] must be a positive integer");
|
|
|
+ throw new IllegalArgumentException("[" + MAX_ANALYZED_OFFSET_FIELD + "] must be a positive integer");
|
|
|
}
|
|
|
this.maxAnalyzedOffset = maxAnalyzedOffset;
|
|
|
return (HB) this;
|
|
|
@@ -616,9 +601,6 @@ public abstract class AbstractHighlighterBuilder<HB extends AbstractHighlighterB
|
|
|
if (options != null && options.size() > 0) {
|
|
|
builder.field(OPTIONS_FIELD.getPreferredName(), options);
|
|
|
}
|
|
|
- if (forceSource != null) {
|
|
|
- builder.field(FORCE_SOURCE_FIELD.getPreferredName(), forceSource);
|
|
|
- }
|
|
|
if (requireFieldMatch != null) {
|
|
|
builder.field(REQUIRE_FIELD_MATCH_FIELD.getPreferredName(), requireFieldMatch);
|
|
|
}
|
|
|
@@ -648,7 +630,7 @@ public abstract class AbstractHighlighterBuilder<HB extends AbstractHighlighterB
|
|
|
parser.declareString(HB::highlighterType, TYPE_FIELD);
|
|
|
parser.declareString(HB::fragmenter, FRAGMENTER_FIELD);
|
|
|
parser.declareInt(HB::noMatchSize, NO_MATCH_SIZE_FIELD);
|
|
|
- parser.declareBoolean(HB::forceSource, FORCE_SOURCE_FIELD);
|
|
|
+ parser.declareBoolean((builder, value) -> {}, FORCE_SOURCE_FIELD); // force_source is ignored
|
|
|
parser.declareInt(HB::phraseLimit, PHRASE_LIMIT_FIELD);
|
|
|
parser.declareInt(HB::maxAnalyzedOffset, MAX_ANALYZED_OFFSET_FIELD);
|
|
|
parser.declareObject(HB::options, (XContentParser p, Void c) -> {
|
|
|
@@ -691,7 +673,6 @@ public abstract class AbstractHighlighterBuilder<HB extends AbstractHighlighterB
|
|
|
highlightQuery,
|
|
|
order,
|
|
|
highlightFilter,
|
|
|
- forceSource,
|
|
|
boundaryScannerType,
|
|
|
boundaryMaxScan,
|
|
|
Arrays.hashCode(boundaryChars),
|
|
|
@@ -729,7 +710,6 @@ public abstract class AbstractHighlighterBuilder<HB extends AbstractHighlighterB
|
|
|
&& Objects.equals(highlightQuery, other.highlightQuery)
|
|
|
&& Objects.equals(order, other.order)
|
|
|
&& Objects.equals(highlightFilter, other.highlightFilter)
|
|
|
- && Objects.equals(forceSource, other.forceSource)
|
|
|
&& Objects.equals(boundaryScannerType, other.boundaryScannerType)
|
|
|
&& Objects.equals(boundaryMaxScan, other.boundaryMaxScan)
|
|
|
&& Arrays.equals(boundaryChars, other.boundaryChars)
|