lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From 小鱼儿 <>
Subject Why Lucene's Suggest API can ONLY load field terms which is Store.YES?
Date Fri, 27 Dec 2019 08:32:30 GMT
I have a document `category` field, which is a "|,;" separator separated
string, in indexing phase, i do manually split the value into atomic terms
and index as StringField, & i also add a same name StoredField which
contains original value form:

*List<String> terms = analyzer.analysis((String)fieldValue); for(String
term: terms) {      doc.add(new StringField(fieldName, term, Store.NO));
}doc.add(new StoredField(fieldName, (String)fieldValue));*

Then i use Suggest API to load this field's all terms:

*        Set<String> terms = new HashSet<String>();
DocumentDictionary dict = new DocumentDictionary(this.indexReader,
fieldName, null);        InputIterator it;        try {            it =
dict.getEntryIterator();            //            BytesRef byteRef = null;
          while((byteRef = != null){                String term
= byteRef.utf8ToString();                terms.add(term);            }
  } catch (IOException e) {            e.printStackTrace();
log.error(e.getMessage(), e);        }*

To my supprise, terms seems only returning the STORED value, which is the
original value form, but i expect they should be the terms i put in each

Is this a design miss or impl. limit?

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message