• <bdo id='O18p0'></bdo><ul id='O18p0'></ul>
    1. <tfoot id='O18p0'></tfoot>

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

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

        Lucene 4.0 IndexWriter updateDocument 用于数字项

        时间:2023-09-29
        <tfoot id='emg8c'></tfoot>
          <bdo id='emg8c'></bdo><ul id='emg8c'></ul>

              <tbody id='emg8c'></tbody>
            <legend id='emg8c'><style id='emg8c'><dir id='emg8c'><q id='emg8c'></q></dir></style></legend>

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

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

                  本文介绍了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 用于数字项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:是什么导致错误'一个 SPI 类型的 lucene.codecs. 下一篇:无法使用 lucene IndexWriter.deleteDocuments(term) 删除文

                  相关文章

                  最新文章

                1. <legend id='aDEgI'><style id='aDEgI'><dir id='aDEgI'><q id='aDEgI'></q></dir></style></legend>

                    1. <small id='aDEgI'></small><noframes id='aDEgI'>

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