在lucene3.0以上版本中,范围查询也有很大的变化,RangeQuery已经不推荐使用,使用TermRangeQuery和NumericRangeQuery两个替代。
TermRangeQuery主要用于文本范围查找;
TermRangeQuery query = new TermRangeQuery(field,
"2009年01月01日","2009年01月05日",true,true);
ScoreDoc[] hits = searcher.search(query, null, topnum).scoreDocs;

NumericRangeQuery:要使用它,首先要使用NumericField 给数字建索引(当然这个的term就是数字的了)。如果你的term是文本,那就是使用TermRangeQuery 。

英文原文:
public TermRangeQuery(String field,
String lowerTerm,
String upperTerm,
boolean includeLower,
boolean includeUpper)
Constructs a query selecting all terms greater/equal than lowerTerm but less/equal than upperTerm.

If an endpoint is null, it is said to be "open". Either or both endpoints may be open. Open endpoints may not be exclusive (you can't select all but the first or last term without explicitly specifying the term to exclude.)

Parameters:
field - The field that holds both lower and upper terms.
lowerTerm - The term text at the lower end of the range
upperTerm - The term text at the upper end of the range
includeLower - If true, the lowerTerm is included in the range.
includeUpper - If true, the upperTerm is included in the range.

lucene3.0范围查找的更多相关文章

  1. swift 3.0 正则表达式查找/替换字符

    1.什么是正则表达式 正则表达式,又称正规表示法.常规表示法(英语:Regular Expression,在代码中常简写为regex.regexp或RE),计算机科学的一个概念.正则表达式使用单个字符 ...

  2. 全文检索 使用最新lucene3.0.3+最新盘古分词 pangu2.4 .net 实例

    开发环境 vs2015 winform 程序 1 首先需要下载对应的DLL 文章后面统一提供程序下载地址 里面都有 2 配置pangu的参数 也可以不配置 采用默认的即可 3 创建索引,将索引存放到本 ...

  3. <转>lucene3.0 自学吧 四 termdocs

    http://www.cnblogs.com/LeftNotEasy/archive/2010/01/26/1656426.html http://www.doc100.net/bugs/t/5402 ...

  4. Lucene3.0详解

    http://www.open-open.com/lib/view/open1331275900374.html

  5. Lucene6.6.0 案例与学习路线

    之前在学习Lucene这个全文检索工具,为项目搜索引擎的开发打下基础.在这里先分享一下关于Lucene的学习心得. 核心的学习流程是:索引文件格式--索引创建过程--检索流程. 1.首先建议参看这篇精 ...

  6. 从一个NOI题目再学习二分查找。

    二分法的基本思路是对一个有序序列(递增递减都可以)查找时,测试一个中间下标处的值,若值比期待值小,则在更大的一侧进行查找(反之亦然),查找时再次二分.这比顺序访问要少很多访问量,效率很高. 设:low ...

  7. [原创]C#应用WindowsApi实现查找\枚举(FindWindow、EnumChildWindows)窗体控件,并发送消息。

    首先介绍基本WindowsApi: public static extern IntPtr FindWindow(string lpClassName, string lpWindowName); 函 ...

  8. js冒泡排序与二分法查找

    冒泡排序 var attr=[1,5,7,6,3,9,2,8,4]; var zj=0; //控制比较轮数 for(var i=0;i<attr.length-1;i++) { //控制每轮的比 ...

  9. B-树的插入、查找、删除

    转自:http://blog.163.com/zhoumhan_0351/blog/static/39954227200910231032917/ 前面讨论的查找都是内查询算法,被查询的数据都在内存. ...

随机推荐

  1. python(六):面型对象--类的特殊方法

    一.跟实例创建和执行有关的 __new__.__init__.__call__. 类加括号调用了__init__方法来创建一个实例对象.这一过程分成了两步: 类调用__new__来创建实例对象,__n ...

  2. MySQL 根据身份证查找年龄段

    SELECT       idcard,YEAR (NOW()) - substring(idcard, 7, 4) as nFROM es_members where idcard >0 HA ...

  3. {Notes}{Latex}{multirow}

    这个文章写的真的太牛比了! ============================================================ 在latex文件最前面用这个包\usepackag ...

  4. homeland 开源论坛系统搭建试用

    备注: 需要使用docker docker-compose   1. clone 代码 git clone https://github.com/ruby-china/homeland-docker. ...

  5. sqlserver docker 安装部署试用

    1. 镜像   docker pull exoplatform/sqlserver 2. 镜像参数    docker run -d -e SA_PASSWORD=<passord> -e ...

  6. 笔记:FastAdmin 之 jQuery 选择器 $("[name$='[]']", form) 学习

    笔记:FastAdmin 之 jQuery 选择器 $("[name$='[]']", form) 学习 $("[name$='[]']", form)这个是什 ...

  7. ecmall 2.3.0 最新补丁20140618

    特别提示:补丁下载地址为:http://download.ecshop.com开头,该地址为ecmall下载站,如果非以http://download.ecshop.com开头,请勿下载,同时请反馈给 ...

  8. pandas之DateFrame 数据过滤+遍历行+读写csv-txt-excel

    # XLS转CSV df = pd.read_excel(r'列表.xls') df2 = pd.DataFrame()df2 = df2.append(list(df['列名']), ignore_ ...

  9. VMware下安装的Mac OS X如何修改显示分辨率 (转)

    我在Win7下利用VMware安装了苹果的OS x 10.8系统,安装成功启动后,发现分辨率为1024*768,而宿机的分辨率是1440*900,我想让虚拟机全屏显示,也就是想在雪豹下屏幕的分辨率也能 ...

  10. FPGA设计者必须精通的5项基本功

    FPGA设计者的5项基本功:仿真.综合.时序分析.调试.验证. 对于FPGA设计者来说,练好这5项基本功,与用好相应的EDA工具是同一过程,对应关系如下: 1. 仿真:Modelsim, Quartu ...