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

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

      <i id='1QFrU'><tr id='1QFrU'><dt id='1QFrU'><q id='1QFrU'><span id='1QFrU'><b id='1QFrU'><form id='1QFrU'><ins id='1QFrU'></ins><ul id='1QFrU'></ul><sub id='1QFrU'></sub></form><legend id='1QFrU'></legend><bdo id='1QFrU'><pre id='1QFrU'><center id='1QFrU'></center></pre></bdo></b><th id='1QFrU'></th></span></q></dt></tr></i><div id='1QFrU'><tfoot id='1QFrU'></tfoot><dl id='1QFrU'><fieldset id='1QFrU'></fieldset></dl></div>
      1. 在 Java 中使用 Lucene 搜索日期范围?

        Searching on date ranges with Lucene in Java?(在 Java 中使用 Lucene 搜索日期范围?)
          <i id='R2whw'><tr id='R2whw'><dt id='R2whw'><q id='R2whw'><span id='R2whw'><b id='R2whw'><form id='R2whw'><ins id='R2whw'></ins><ul id='R2whw'></ul><sub id='R2whw'></sub></form><legend id='R2whw'></legend><bdo id='R2whw'><pre id='R2whw'><center id='R2whw'></center></pre></bdo></b><th id='R2whw'></th></span></q></dt></tr></i><div id='R2whw'><tfoot id='R2whw'></tfoot><dl id='R2whw'><fieldset id='R2whw'></fieldset></dl></div>

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

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

              • <legend id='R2whw'><style id='R2whw'><dir id='R2whw'><q id='R2whw'></q></dir></style></legend>

                  <tbody id='R2whw'></tbody>
                  <tfoot id='R2whw'></tfoot>

                  本文介绍了在 Java 中使用 Lucene 搜索日期范围?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  是否可以在 Java 中使用 Lucene 搜索日期范围?如何根据日期字段和日期范围构建 Lucene 搜索查询?例如:

                  Is it possible to search on date ranges using Lucene in Java? How do I build Lucene search queries based on date fields and dates ranges? For example:

                  • 在指定日期之间
                  • 在指定日期之前
                  • 在指定日期之后
                  • 过去 24 小时内
                  • 过去一周内
                  • 在过去一个月内.

                  我使用的是 Lucene 2.4.1,我的系统非常旧,而且测试非常糟糕,所以我希望尽可能不必升级

                  i'm using Lucene 2.4.1 and my system is really legacy and really poorly tested so i would like if possible not to have to upgrade

                  推荐答案

                  Lucene(无论如何在 2.9 版本之前)只存储字符串值,并且它只支持对该数据的字典范围查询.因此,如果您想存储日期/时间数据并对其执行范围查询,则需要明确格式化您的数据/时间值,使其按字典顺序排列.

                  Lucene (before version 2.9 anyway) only stores String values, and it only supports lexicographical range queries on that data. So if you want to store date/time data and performa range queries on it, you need to explicitly format your data/time values in such a way as to make them lexicographically ordered.

                  例如,将您的日期/时间存储为 2009-10-29T15:34:00 之类的内容,然后进行范围查询,例如 [2009-10-29T15:00:00TO 2009-10-29T16:00:00]

                  For example, store your date/times as something like 2009-10-29T15:34:00, and then do range queries like [2009-10-29T15:00:00 TO 2009-10-29T16:00:00]

                  正如其他地方所指出的,Lucene 2.9 最终引入了对非字符串数据范围查询的支持,这让这一切变得更加容易.

                  As has been pointed out elsewhere, Lucene 2.9 finally introduced support for range queries against non-string data, making this all rather easier.

                  这篇关于在 Java 中使用 Lucene 搜索日期范围?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  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 中的默认语言环境设置以使其保持一致?)
                1. <tfoot id='lPTpV'></tfoot>

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

                      <tbody id='lPTpV'></tbody>

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