|
31 | 31 | import org.apache.lucene.document.Field;
|
32 | 32 | import org.apache.lucene.index.IndexOptions;
|
33 | 33 | import org.apache.lucene.index.IndexableField;
|
34 |
| -import org.apache.lucene.index.Term; |
35 |
| -import org.apache.lucene.search.NormsFieldExistsQuery; |
36 |
| -import org.apache.lucene.search.PrefixQuery; |
37 |
| -import org.apache.lucene.search.Query; |
38 |
| -import org.apache.lucene.search.TermQuery; |
39 |
| -import org.apache.lucene.search.spans.SpanMultiTermQueryWrapper; |
40 |
| -import org.apache.lucene.search.spans.SpanQuery; |
41 | 34 | import org.elasticsearch.ElasticsearchParseException;
|
42 | 35 | import org.elasticsearch.common.settings.Settings;
|
43 | 36 | import org.elasticsearch.common.xcontent.XContentBuilder;
|
44 | 37 | import org.elasticsearch.common.xcontent.support.XContentMapValues;
|
45 | 38 | import org.elasticsearch.index.analysis.AnalyzerScope;
|
46 | 39 | import org.elasticsearch.index.analysis.NamedAnalyzer;
|
47 | 40 | import org.elasticsearch.index.mapper.FieldMapper;
|
48 |
| -import org.elasticsearch.index.mapper.FieldNamesFieldMapper; |
49 | 41 | import org.elasticsearch.index.mapper.MappedFieldType;
|
50 | 42 | import org.elasticsearch.index.mapper.Mapper;
|
51 | 43 | import org.elasticsearch.index.mapper.MapperParsingException;
|
52 | 44 | import org.elasticsearch.index.mapper.ParseContext;
|
53 |
| -import org.elasticsearch.index.mapper.StringFieldType; |
54 | 45 | import org.elasticsearch.index.mapper.TextFieldMapper;
|
55 | 46 | import org.elasticsearch.index.mapper.annotatedtext.AnnotatedTextFieldMapper.AnnotatedText.AnnotationToken;
|
56 |
| -import org.elasticsearch.index.query.QueryShardContext; |
57 | 47 | import org.elasticsearch.search.fetch.FetchSubPhase.HitContext;
|
58 | 48 |
|
59 | 49 | import java.io.IOException;
|
@@ -531,7 +521,7 @@ private void emitAnnotation(int firstSpannedTextPosInc, int annotationPosLen) th
|
531 | 521 | }
|
532 | 522 |
|
533 | 523 |
|
534 |
| - public static final class AnnotatedTextFieldType extends StringFieldType { |
| 524 | + public static final class AnnotatedTextFieldType extends TextFieldMapper.TextFieldType { |
535 | 525 |
|
536 | 526 | public AnnotatedTextFieldType() {
|
537 | 527 | setTokenized(true);
|
@@ -562,37 +552,6 @@ public String typeName() {
|
562 | 552 | return CONTENT_TYPE;
|
563 | 553 | }
|
564 | 554 |
|
565 |
| - @Override |
566 |
| - public Query existsQuery(QueryShardContext context) { |
567 |
| - if (omitNorms()) { |
568 |
| - return new TermQuery(new Term(FieldNamesFieldMapper.NAME, name())); |
569 |
| - } else { |
570 |
| - return new NormsFieldExistsQuery(name()); |
571 |
| - } |
572 |
| - } |
573 |
| - |
574 |
| - @Override |
575 |
| - public SpanQuery spanPrefixQuery(String value, SpanMultiTermQueryWrapper.SpanRewriteMethod method, QueryShardContext context) { |
576 |
| - SpanMultiTermQueryWrapper<?> spanMulti = |
577 |
| - new SpanMultiTermQueryWrapper<>(new PrefixQuery(new Term(name(), indexedValueForSearch(value)))); |
578 |
| - spanMulti.setRewriteMethod(method); |
579 |
| - return spanMulti; |
580 |
| - } |
581 |
| - |
582 |
| - @Override |
583 |
| - public Query phraseQuery(TokenStream stream, int slop, boolean enablePositionIncrements) throws IOException { |
584 |
| - return TextFieldMapper.createPhraseQuery(stream, name(), slop, enablePositionIncrements); |
585 |
| - } |
586 |
| - |
587 |
| - @Override |
588 |
| - public Query multiPhraseQuery(TokenStream stream, int slop, boolean enablePositionIncrements) throws IOException { |
589 |
| - return TextFieldMapper.createPhraseQuery(stream, name(), slop, enablePositionIncrements); |
590 |
| - } |
591 |
| - |
592 |
| - @Override |
593 |
| - public Query phrasePrefixQuery(TokenStream stream, int slop, int maxExpansions) throws IOException { |
594 |
| - return TextFieldMapper.createPhrasePrefixQuery(stream, name(), slop, maxExpansions, null, null); |
595 |
| - } |
596 | 555 | }
|
597 | 556 |
|
598 | 557 | private int positionIncrementGap;
|
|
0 commit comments