Lucene インデックスから内でTokenStream
使用されたトークン (トークンのリスト、 、またはその他のもの)を取得するにはどうすればよいですか? つまり、(例から) で使用されたトークンをインデックスから取得することは可能ですか? (からトークンを取得する方法は知りません)Field
Document
tokens
TokenStream
doc.add(new Field("title", tokens))
ドキュメントにはありますがField.tokenStreamValue()
、doc.getFieldable(field_name)
そうすると単に返されますnull
。
私も試しました(luceneの3番目のコメントから- Fieldable.tokenStreamValue()):
TokenSources.getTokenStream(reader, doc_id, field_name)
しかし、私は得る
java.lang.IllegalArgumentException: title in doc #630does not have any term position data stored
at org.apache.lucene.search.highlight.TokenSources.getTokenStream(TokenSources.java:256)