|
31 | 31 | import org.apache.lucene.document.Field.Store;
|
32 | 32 | import org.apache.lucene.document.IntField;
|
33 | 33 | import org.apache.lucene.document.LongField;
|
| 34 | +import org.apache.lucene.document.NumericDocValuesField; |
| 35 | +import org.apache.lucene.document.SortedDocValuesField; |
34 | 36 | import org.apache.lucene.document.TextField;
|
35 | 37 | import org.apache.lucene.index.DirectoryReader;
|
36 | 38 | import org.apache.lucene.index.IndexWriter;
|
|
49 | 51 | import org.apache.lucene.search.TopScoreDocCollector;
|
50 | 52 | import org.apache.lucene.store.Directory;
|
51 | 53 | import org.apache.lucene.store.FSDirectory;
|
| 54 | +import org.apache.lucene.util.BytesRef; |
52 | 55 | import org.slf4j.Logger;
|
53 | 56 | import org.slf4j.LoggerFactory;
|
54 | 57 |
|
@@ -549,21 +552,25 @@ private void toDocField(Document doc, Lucene lucene, Date value) {
|
549 | 552 | return;
|
550 | 553 | }
|
551 | 554 | doc.add(new LongField(lucene.name(), value.getTime(), Store.YES));
|
| 555 | + doc.add(new NumericDocValuesField(lucene.name(), value.getTime())); |
552 | 556 | }
|
553 | 557 |
|
554 | 558 | private void toDocField(Document doc, Lucene lucene, long value) {
|
555 | 559 | doc.add(new LongField(lucene.name(), value, Store.YES));
|
| 560 | + doc.add(new NumericDocValuesField(lucene.name(), value)); |
556 | 561 | }
|
557 | 562 |
|
558 | 563 | private void toDocField(Document doc, Lucene lucene, int value) {
|
559 | 564 | doc.add(new IntField(lucene.name(), value, Store.YES));
|
| 565 | + doc.add(new NumericDocValuesField(lucene.name(), value)); |
560 | 566 | }
|
561 | 567 |
|
562 | 568 | private void toDocField(Document doc, Lucene lucene, String value) {
|
563 | 569 | if (StringUtils.isEmpty(value)) {
|
564 | 570 | return;
|
565 | 571 | }
|
566 | 572 | doc.add(new org.apache.lucene.document.Field(lucene.name(), value, TextField.TYPE_STORED));
|
| 573 | + doc.add(new SortedDocValuesField(lucene.name(), new BytesRef(value))); |
567 | 574 | }
|
568 | 575 |
|
569 | 576 | /**
|
|
0 commit comments