Skip to content

Commit 1741b80

Browse files
committed
still have to change derived field generator
Signed-off-by: Anthony Leong <aj.leong623@gmail.com>
1 parent f16b39f commit 1741b80

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

rest-api-spec/src/main/resources/rest-api-spec/test/search/270_wildcard_fieldtype_queries.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -408,5 +408,5 @@ setup:
408408
- my_field.doc_values:
409409
order: asc
410410
size: 4
411-
- match: { hits.total.value: 4 }
411+
- match: { hits.total.value: 8 }
412412
- match: { hits.hits.0._id: "8" }

server/src/main/java/org/opensearch/index/mapper/WildcardFieldMapper.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,12 @@
1010

1111
import org.apache.lucene.analysis.Tokenizer;
1212
import org.apache.lucene.analysis.tokenattributes.CharTermAttribute;
13+
import org.apache.lucene.document.BinaryDocValuesField;
1314
import org.apache.lucene.document.Field;
1415
import org.apache.lucene.document.FieldType;
1516
import org.apache.lucene.document.SortedSetDocValuesField;
1617
import org.apache.lucene.document.StringField;
18+
import org.apache.lucene.index.BinaryDocValues;
1719
import org.apache.lucene.index.IndexOptions;
1820
import org.apache.lucene.index.LeafReaderContext;
1921
import org.apache.lucene.index.Term;
@@ -48,6 +50,7 @@
4850
import org.opensearch.index.analysis.IndexAnalyzers;
4951
import org.opensearch.index.analysis.NamedAnalyzer;
5052
import org.opensearch.index.fielddata.IndexFieldData;
53+
import org.opensearch.index.fielddata.plain.BinaryIndexFieldData;
5154
import org.opensearch.index.fielddata.plain.SortedSetOrdinalsIndexFieldData;
5255
import org.opensearch.index.query.QueryShardContext;
5356
import org.opensearch.search.DocValueFormat;
@@ -220,9 +223,9 @@ protected void parseCreateField(ParseContext context) throws IOException {
220223
Tokenizer tokenizer = new WildcardFieldTokenizer();
221224
tokenizer.setReader(new StringReader(value));
222225
context.doc().add(new Field(fieldType().name(), tokenizer, FIELD_TYPE));
223-
context.doc().add(new StringField(fieldType().name(), value, null));
226+
//context.doc().add(new StringField(fieldType().name(), value, null));
224227
if (fieldType().hasDocValues()) {
225-
context.doc().add(new SortedSetDocValuesField(fieldType().name(), binaryValue));
228+
context.doc().add(new BinaryDocValuesField(fieldType().name(), binaryValue));
226229
} else {
227230
if (fieldType().hasDocValues() == false) {
228231
createFieldNamesField(context);
@@ -368,7 +371,7 @@ NamedAnalyzer normalizer() {
368371
@Override
369372
public IndexFieldData.Builder fielddataBuilder(String fullyQualifiedIndexName, Supplier<SearchLookup> searchLookup) {
370373
failIfNoDocValues();
371-
return new SortedSetOrdinalsIndexFieldData.Builder(name(), CoreValuesSourceType.BYTES);
374+
return new BinaryIndexFieldData.Builder(name(), CoreValuesSourceType.BYTES);
372375
}
373376

374377
@Override

0 commit comments

Comments
 (0)