- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
在阅读“Lucene in Action 2nd edition”时,我看到了关于 Filter
的描述。可用于在 Lucene 中进行结果过滤的类。 Lucene 有很多过滤器重复 Query
类。例如,NumericRangeQuery
和 NumericRangeFilter
.
书上说NRF
与 NRQ
完全相同但没有文件评分。这是否意味着如果我不需要评分或按文档字段值对文档进行排序,我应该更喜欢Filter
结束 Query
从性能的角度来看?
最佳答案
我从 Uwe Schindler 那里得到了很好的回答,让我在这里重新发布。
If you dont cache filters, queries will be faster, as the ConjunctionScorer in Lucene has optimizations, which are currently not used for Filters. Filters are fine, if you cache them (e.g. if you always have the same access restrictions for a specific user that are applied to all his queries). In that case the Filter is only executed once and cached for all further requests and then intersected with the query result set.
If you only want to e.g. randomly "filter" e.g. by a variable numeric range like a bounding box in a geographic search, use queries, queries are in most cases faster (e.g. Range Queries and similar stuff - called MultiTermQueries - are internally also implemented by the same BitSet algorithm like the Filter - in fact they are only Filters wrapped by a Scorer-impl). But the Scorer that ANDs the query and your "filter" query together (ConjunctionScorer) is generally faster than the code that applies the filter after searching. This may some improvement possible, but in general filters are something in Lucene that is not really needed anymore, so there were already some approaches to make Filters and Queries the same, and instead then be able to also cache non-scoring queries. This would make lots of code easier.
Filters can bring a huge speed improvement with Lucene 4.0, if they are plugged ontop of the IndexReader to filter the documents before scoring, but that's not yet implemented (see https://issues.apache.org/jira/browse/LUCENE-3212) - I am working on it. We may also make Filters random access (it's easy as they are bitsets), which could improve also the after-query filtering. But I would then also make Queries partially random access, if they could support it (like queries that are only based on FieldCache).
Uwe
关于java - {Filter}ing 是否比 Lucene 中的 {Query}ing 更快?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6462350/
以下片段的效果之间有什么区别(如果有的话): cout << "Some text" << s1 << "some more text\n"; cout << "Some text" + s1 + "
在解释器模式下运行 python 时,什么是 more-ing 或 less-ing 多行输出的最佳替代方案? 假设,存在一个对象变量foo,它有很多属性。 dir(foo) 会转储到屏幕上。我们无法
在阅读“Lucene in Action 2nd edition”时,我看到了关于 Filter 的描述。可用于在 Lucene 中进行结果过滤的类。 Lucene 有很多过滤器重复 Query类。例
为了满足我对 C 知识的渴求,在连接到我的家庭网络的两个 linux 机器上,我正在编写一个基本的 telnet,它包含 send() 和 recv( ) 的字符串(只是为了获得套接字和线程的一些经验
给定以下三个简单函数: func twice_Array_of_Int(a: [Int]) -> [Int] { return a + a } func twice_Array_of_T(a:
如我的 previous question 中所述,我正在尝试在功能上制作一些有点像向导的东西。我已经确定了一个单独的框架,并添加了一个sizer。我为希望用户看到的每个屏幕构建面板,将它们添加到框架
据我了解,range-v3 库的 View 操作(目前需要 C++17,但要成为 C++20 中 STL 的正式部分)提供了可链接的类 STL 算法,这些算法是延迟计算的。作为实验,我创建了以下代码来
如何选择来自一位特定作者的所有项目?可能这样吗?或者,如果我也想要很多项目类型和项目包(项目有很多项目),我该如何编辑实体? 元素 /** * @ORM\Table() * @ORM\Entity
我想选择以正则表达式结尾的单词,但我想排除以 thing 结尾的单词。例如: everything running catching nothing 这几个词中,选running和catching,排
使用 Julia 1.5.3 和 Julia 1.6.0 两个版本似乎都不支持 & 用于 BitArrays。 我有两个 BitArray,例如 x = BitArray([1,0,1]) 和 y=B
我有一个读取二进制文件然后使用 struct.unpack() 解压文件内容的函数。我的功能工作得很好。如果/当我使用长的“格式”字符串解压缩整个文件时,它会更快。问题是有时字节对齐会发生变化,因此我
阅读维基百科上的“ARM 架构”,发现以下说法: Registers R0-R7 are the same across all CPU modes; they are never banked. R
您好,我需要 ssh 到一个 IP 地址并通过 shell 脚本运行我的 Java 代码我就是这样做的 ssh $LINE java -Djava.library.path=/N/u/sbpatil/
该程序应该读取字符串输入的值并返回结果。 但是,当我使用 System.out.println(Arrays.toString(stack.toArray())); 为了检查堆栈在最后甚至在程序期间的
在 Alpine 镜像中构建的 GO 可执行文件存在一个奇怪的行为,其中标准 LD_PRELOAD 功能无法正常工作。 看起来像 构造函数未被调用 由动态加载器! 我有一个示例 go 应用程序(get
已关闭。此问题不符合Stack Overflow guidelines 。目前不接受答案。 要求提供代码的问题必须表现出对所解决问题的最低限度的了解。包括尝试的解决方案、为什么它们不起作用以及预期结果
我在下面写这段代码,发现了这个奇怪的行为: #include #include #include using namespace std; int main() { map map1;
我对 JS 的 .sort() 函数理解得很好,对多维数组的理解也比较松散,但我有点卡住了。这是我得到的: var player1 = ["bob", 20]; var player2 = ["jon
在 python 中有更好的方法吗?: ((w.endswith('<') or w.endswith('')) 也许可以使用任何 最佳答案 字符串上的 endswith 方法可以将元组作为参数:
在 Javascript 中,有没有一种方法可以从数组中选择包含某些内容的单词。例如,["swimming", "basketball", "chess", "rowing"],我只想选择包含“-in
我是一名优秀的程序员,十分优秀!