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

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

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

        使用 BooleanQuery 还是编写更多索引?

        时间:2023-09-29
          <tfoot id='yhNd7'></tfoot>
          <legend id='yhNd7'><style id='yhNd7'><dir id='yhNd7'><q id='yhNd7'></q></dir></style></legend>
            <bdo id='yhNd7'></bdo><ul id='yhNd7'></ul>

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

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

                  <tbody id='yhNd7'></tbody>
                • 本文介绍了使用 BooleanQuery 还是编写更多索引?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  这样的类别树:

                  root_1
                    sub_1
                    sub_2
                    ... to sub_20 
                  

                  每个文档都有一个子类别(如 sub_2).现在,我只在lucene索引中写了sub_2:

                  Every document has a sub category(like sub_2). Now, I only wrote sub_2 in lucene index:

                  new NumericField("category",...).setIntValue(sub_2.getID());
                  

                  我想获取所有 root_1 的文档,使用 BooleanQuery(将 sub_1 合并到 sub_20)在每个条目文档中搜索或写入其他类别:

                  I want to get all root_1's documents, using BooleanQuery (merge the sub_1 to sub_20) to search or write an other category in every entry document:

                  new NumericField("category",...).setIntValue(sub_2.getID());
                  new NumericField("category",...).setIntValue(root_1.getID());//sub_2's ancestor category
                  

                  哪个是更好的选择?

                  推荐答案

                  我将使用类别层次结构的路径枚举/'Dewey Decimal' 表示.也就是说,不是只为第一个根的第二个孩子存储sub_2",而是存储类似001.002"的东西.

                  I would use a path enumeration/'Dewey Decimal' representation of the category hierarchy. That is, instead of just storing 'sub_2' for the second child of the first root, store instead something like '001.002'.

                  要查找根及其所有子项,您可以搜索category:001*".

                  To find the root and all of its children, you would search on "category:001*".

                  要仅查找根的子项,您可以搜索category:001.*".

                  To find only the children of the root, you would search on "category:001.*".

                  (另请参阅 如何将树数据存储在 Lucene/Solr/Elasticsearch 索引或 NoSQL 数据库中?.)

                  这篇关于使用 BooleanQuery 还是编写更多索引?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:使用 JdbcDirectory 在数据库中创建 Lucene 索引 下一篇:MongoDB 是关系 db + lucene 的有效替代品吗?

                  相关文章

                  最新文章

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

                • <tfoot id='n28Nf'></tfoot>
                    <bdo id='n28Nf'></bdo><ul id='n28Nf'></ul>
                  <legend id='n28Nf'><style id='n28Nf'><dir id='n28Nf'><q id='n28Nf'></q></dir></style></legend>

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