ReversedWildcardFilterFactory 如何加速通配符搜索?
How does ReversedWildcardFilterFactory speed up wildcard searches?
Solr docs 说:
solr.ReversedWildcardFilterFactory
A filter that reverses tokens to provide faster leading wildcard and
prefix queries. Add this filter to the index analyzer, but not the
query analyzer. The standard Solr query parser will
use this to reverse wildcard and prefix queries to improve
performance...
它是怎么做到的?
既然所有的token都运行通过了ReversedWildcardFilterFactory,它是不是把所有的token都反向存储了? (我觉得这很傻)
或者,它是否正常存储所有标记 和 反向标记,然后 运行 通过索引列表存储大约两倍的查询时间? (大概这仍然比使用前导 * 搜索快得多)
我感到困惑的部分原因是,在 Solr 的示例 schema.xml
中,它们执行以下操作:
<copyField source="*_en" dest="text_en_index"/>
<copyField source="*_en" dest="text_rev_index"/>
其中 text_rev_index
使用 ReversedWildcardFilterFactory
。如果 ReversedWildcardFilterFactory
同时存储正向和反向标记,我不确定为什么他们会将这些字段复制到正向和反向 dest
字段。
来自https://docs.lucidworks.com/display/lweug/Wildcard+Queries:
The Lucid query parser will detect when leading wildcards are used and
invoke the reversal filter, if present in the index analyzer, to
reverse the wildcard term so that it will generate the proper query
term that will match the reversed terms that are stored in the index
for this field.
Solr docs 说:
solr.ReversedWildcardFilterFactory
A filter that reverses tokens to provide faster leading wildcard and prefix queries. Add this filter to the index analyzer, but not the query analyzer. The standard Solr query parser will use this to reverse wildcard and prefix queries to improve performance...
它是怎么做到的?
既然所有的token都运行通过了ReversedWildcardFilterFactory,它是不是把所有的token都反向存储了? (我觉得这很傻)
或者,它是否正常存储所有标记 和 反向标记,然后 运行 通过索引列表存储大约两倍的查询时间? (大概这仍然比使用前导 * 搜索快得多)
我感到困惑的部分原因是,在 Solr 的示例 schema.xml
中,它们执行以下操作:
<copyField source="*_en" dest="text_en_index"/>
<copyField source="*_en" dest="text_rev_index"/>
其中 text_rev_index
使用 ReversedWildcardFilterFactory
。如果 ReversedWildcardFilterFactory
同时存储正向和反向标记,我不确定为什么他们会将这些字段复制到正向和反向 dest
字段。
来自https://docs.lucidworks.com/display/lweug/Wildcard+Queries:
The Lucid query parser will detect when leading wildcards are used and invoke the reversal filter, if present in the index analyzer, to reverse the wildcard term so that it will generate the proper query term that will match the reversed terms that are stored in the index for this field.