博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
lucene-SpanNotQuery和SpanOrQuery交迭与全局跨度
阅读量:7241 次
发布时间:2019-06-29

本文共 1219 字,大约阅读时间需要 4 分钟。

1、在匹配结果中排除相互交迭的跨度

SpanNotQuery构造函数的第一个参数表示要包含的跨度对象,第二个参数表示要排除的跨度对象。

1)

SpanNearQuery quick_fox=new SpanNearQuery(new SpanQuery[]{quick,fox},1,true);

dumpSpans查询时输出

the <quick brown fox> jumps over the lazy dog (0.18461232)

the <quick red fox> jumps over the sleep cat (0.18461232)

2)

SpanNotQuery quick_fox_dog=new SpanNotQuery(quick_fox,dog);

dumpSpans查询时输出

the <quick brown fox> jumps over the lazy dog (0.18461232)

the <quick red fox> jumps over the sleep cat (0.18461232)

3)只匹配了第一个文档,因为第二个文档包括red

SpanNotQuery no_quick_red_fox=new SpanNotQuery(quick_fox,red);

dumpSpans查询时输出

the <quick red fox> jumps over the sleep cat (0.18461232)

2、SpanOrQuery,在构造函数中对一个SpanQuery对象的集合进行封装

1)

SpanNearQuery qf_near_ld=new SpanNearQuery(new SpanQuery[]{quick_fox,lazy_dog},3,true);

dumpSpans查询时输出

the <quick brown fox jumps over the lazy dog> (0.38461232)

2)

SpanNearQuery qf_near_sc=new SpanNearQuery(new SpanQuery[]{quick_fox,sleep_cat},3,true);

dumpSpans查询时输出

the <quick red fox jumps over the sleep cat> (0.38461232)

3)查询这样一些文档,这些文档或者包括"quick fox" near "lazy dog"或者包括"quick fox" near "sleep cat"

dumpSpans查询时输出

the <quick brown fox jumps over the lazy dog> (0.38461232)

the <quick red fox jumps over the sleep cat> (0.38461232)

转载地址:http://tiybm.baihongyu.com/

你可能感兴趣的文章
Thread.setDaemon设置说明
查看>>
图像灰度化
查看>>
Java常用工具类之ArrayUtil
查看>>
utuntu16.04安装caffe+Matlab2017a+opencv3.1+CUDA8.0+cudnn6.0
查看>>
netty中的ChannelHandler和ChannelPipeline
查看>>
数据结构 -- 栈
查看>>
官方Java编码规范
查看>>
浏览器神器--vimium
查看>>
由支付宝当面付引发的NatApp方便调试回调
查看>>
进程与线程的一个简单解释
查看>>
SQLServer图数据库一些优点
查看>>
基于贪心算法求解TSP问题(JAVA)
查看>>
DefaultHttpRequestRetryHandler有重试3次的机制啊 为什么要重写?
查看>>
Spring实现文件的上传下载
查看>>
Git常用命令汇总
查看>>
DNS 到底怎么工作的? (How does dns work?)
查看>>
DrawDib 使用例子<转>
查看>>
Mongodb系列- java客户端简单使用(CRUD)
查看>>
前端开发css禁止选中文本
查看>>
php实现冒泡排序
查看>>