• <tfoot id='uKsgf'></tfoot>
      <bdo id='uKsgf'></bdo><ul id='uKsgf'></ul>

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

      2. <legend id='uKsgf'><style id='uKsgf'><dir id='uKsgf'><q id='uKsgf'></q></dir></style></legend>

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

        Using BooleanQuery or write more indexes?(使用 BooleanQuery 还是编写更多索引?)
          1. <i id='dySSu'><tr id='dySSu'><dt id='dySSu'><q id='dySSu'><span id='dySSu'><b id='dySSu'><form id='dySSu'><ins id='dySSu'></ins><ul id='dySSu'></ul><sub id='dySSu'></sub></form><legend id='dySSu'></legend><bdo id='dySSu'><pre id='dySSu'><center id='dySSu'></center></pre></bdo></b><th id='dySSu'></th></span></q></dt></tr></i><div id='dySSu'><tfoot id='dySSu'></tfoot><dl id='dySSu'><fieldset id='dySSu'></fieldset></dl></div>

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

            • <bdo id='dySSu'></bdo><ul id='dySSu'></ul>
                <tbody id='dySSu'></tbody>
              <legend id='dySSu'><style id='dySSu'><dir id='dySSu'><q id='dySSu'></q></dir></style></legend>
                  <tfoot id='dySSu'></tfoot>
                  本文介绍了使用 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 还是编写更多索引?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  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 中的默认语言环境设置以使其保持一致?)
                  <tfoot id='8a4D4'></tfoot>
                  • <legend id='8a4D4'><style id='8a4D4'><dir id='8a4D4'><q id='8a4D4'></q></dir></style></legend>

                    <small id='8a4D4'></small><noframes id='8a4D4'>

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

                          • <bdo id='8a4D4'></bdo><ul id='8a4D4'></ul>

                              <tbody id='8a4D4'></tbody>