• <legend id='Y6hZO'><style id='Y6hZO'><dir id='Y6hZO'><q id='Y6hZO'></q></dir></style></legend>
      1. <tfoot id='Y6hZO'></tfoot>

      2. <small id='Y6hZO'></small><noframes id='Y6hZO'>

          <bdo id='Y6hZO'></bdo><ul id='Y6hZO'></ul>

        <i id='Y6hZO'><tr id='Y6hZO'><dt id='Y6hZO'><q id='Y6hZO'><span id='Y6hZO'><b id='Y6hZO'><form id='Y6hZO'><ins id='Y6hZO'></ins><ul id='Y6hZO'></ul><sub id='Y6hZO'></sub></form><legend id='Y6hZO'></legend><bdo id='Y6hZO'><pre id='Y6hZO'><center id='Y6hZO'></center></pre></bdo></b><th id='Y6hZO'></th></span></q></dt></tr></i><div id='Y6hZO'><tfoot id='Y6hZO'></tfoot><dl id='Y6hZO'><fieldset id='Y6hZO'></fieldset></dl></div>

        Lucene 4.0 IndexWriter updateDocument 用于数字项

        Lucene 4.0 IndexWriter updateDocument for Numeric Term(Lucene 4.0 IndexWriter updateDocument 用于数字项)
      3. <legend id='o46YZ'><style id='o46YZ'><dir id='o46YZ'><q id='o46YZ'></q></dir></style></legend>

        <small id='o46YZ'></small><noframes id='o46YZ'>

        <i id='o46YZ'><tr id='o46YZ'><dt id='o46YZ'><q id='o46YZ'><span id='o46YZ'><b id='o46YZ'><form id='o46YZ'><ins id='o46YZ'></ins><ul id='o46YZ'></ul><sub id='o46YZ'></sub></form><legend id='o46YZ'></legend><bdo id='o46YZ'><pre id='o46YZ'><center id='o46YZ'></center></pre></bdo></b><th id='o46YZ'></th></span></q></dt></tr></i><div id='o46YZ'><tfoot id='o46YZ'></tfoot><dl id='o46YZ'><fieldset id='o46YZ'></fieldset></dl></div>
          <tbody id='o46YZ'></tbody>
            1. <tfoot id='o46YZ'></tfoot>

                  <bdo id='o46YZ'></bdo><ul id='o46YZ'></ul>
                  本文介绍了Lucene 4.0 IndexWriter updateDocument 用于数字项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我只是想知道如何根据数字字段更新(删除/插入)文档.到目前为止,我这样做了:

                  I just wanted to know how it is possible to to update (delete/insert) a document based on a numeric field. So far I did this:

                  LuceneManager.updateDocument(writer, new Term("id",  NumericUtils.intToPrefixCoded(sentenceId)), newDoc);
                  

                  但现在在 Lucene 4.0 中,NumericUtils 类已更改为 this 我不太明白.有什么帮助吗?

                  But now with Lucene 4.0 the NumericUtils class has changed to this which I don't really understand. Any help?

                  推荐答案

                  我会建议,如果可能的话,最好将 ID 存储为关键字字符串,而不是数字.如果它只是一个唯一标识符,那么将索引作为关键字更有意义.这消除了任何与数字格式混淆的需要.

                  I would recommend, if possible, it would be better to store an ID as a keyword string, rather than a number. If it is simply a unique identifier, indexing as a keyword makes much more sense. This removes any need to mess with numeric formatting.

                  如果它实际上被用作数字,那么您可能需要手动执行更新.也就是说,搜索并获取要更新的文档,使用 tryDeleteDocument,然后用 添加文档.据我所知,这基本上就是 updateDocument 所做的.

                  If it is actually being used as a number, then you might need to perform the update manually. That is, search for and fetch the document you wish to update, delete the old document with tryDeleteDocument, and then add the updated version with addDocument. This is basically what updateDocument does anyway, to my knowledge.

                  不过,第一个选项肯定是更好的方法.用作更新 ID 的非数字字段会让生活更轻松.

                  The first option would certainly be the better way, though. A non-numeric field to use as an update ID would make life easier.

                  这篇关于Lucene 4.0 IndexWriter updateDocument 用于数字项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  How to send data to COM PORT using JAVA?(如何使用 JAVA 向 COM PORT 发送数据?)
                  How to make a report page direction to change to quot;rtlquot;?(如何使报表页面方向更改为“rtl?)
                  Use cyrillic .properties file in eclipse project(在 Eclipse 项目中使用西里尔文 .properties 文件)
                  Is there any way to detect an RTL language in Java?(有没有办法在 Java 中检测 RTL 语言?)
                  How to load resource bundle messages from DB in Java?(如何在 Java 中从 DB 加载资源包消息?)
                  How do I change the default locale settings in Java to make them consistent?(如何更改 Java 中的默认语言环境设置以使其保持一致?)
                      • <i id='9kucl'><tr id='9kucl'><dt id='9kucl'><q id='9kucl'><span id='9kucl'><b id='9kucl'><form id='9kucl'><ins id='9kucl'></ins><ul id='9kucl'></ul><sub id='9kucl'></sub></form><legend id='9kucl'></legend><bdo id='9kucl'><pre id='9kucl'><center id='9kucl'></center></pre></bdo></b><th id='9kucl'></th></span></q></dt></tr></i><div id='9kucl'><tfoot id='9kucl'></tfoot><dl id='9kucl'><fieldset id='9kucl'></fieldset></dl></div>
                            <bdo id='9kucl'></bdo><ul id='9kucl'></ul>

                            <small id='9kucl'></small><noframes id='9kucl'>

                            <tfoot id='9kucl'></tfoot>

                              <tbody id='9kucl'></tbody>
                            <legend id='9kucl'><style id='9kucl'><dir id='9kucl'><q id='9kucl'></q></dir></style></legend>