gpt4 book ai didi

lucene - 向 lucene 中的文档添加不可索引的字段 - Field.Index 已弃用

转载 作者:行者123 更新时间:2023-12-05 00:27:07 25 4
gpt4 key购买 nike

现在不推荐使用 Field.Index 向文档添加字段的最佳方法是什么。

这是我正在做的事情以及网上大多数示例的建议:

doc.add(new Field("id", dbID, Store.YES, Field.Index.NOT_ANALYZED_NO_NORMS)); 

在 Field.Index 消失的情况下,在 Fields 上设置 Index 属性的新推荐方法是什么?

最佳答案

使用 org.apache.lucene.document.StoredField对于您不想索引的字段。
引用
http://lucene.apache.org/core/4_6_0/core/org/apache/lucene/document/StoredField.html
了解各种可用的构造函数。
例子:

StoredField strField = new StoredField("id", bag.getId());

希望能帮助到你。

关于lucene - 向 lucene 中的文档添加不可索引的字段 - Field.Index 已弃用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21199779/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com