[英]Redisearch prefix search always returns max 200 for total for multiple fields index
Using python RediSearch client to connect to RediSearch and doing a prefix search which should match 300 documents it only returns 200 if there is another TagField in the index:使用 python RediSearch 客户端连接到 RediSearch 并执行应该匹配 300 个文档的前缀搜索,如果索引中有另一个 TagField,它只会返回 200:
from redisearch import Client, Query, TextField, TagField
client = Client('myindex')
client.create_index([TextField('username'), TagField('age')])
# add 300 documents
for i in range(300):
client.add_document(i, username='user%s' % i, age=i)
res = client.search(Query("@username:user*"))
assert res.total == 300 # this is always 200 no matter how many documents you add.
See Search Query Syntax: Prefix matching请参阅搜索查询语法:前缀匹配
A few notes on prefix searches: As prefixes can be expanded into many many terms, use them with caution.
关于前缀搜索的一些注意事项: 由于前缀可以扩展为许多术语,因此请谨慎使用它们。 There is no magic going on, the expansion will create a Union operation of all suffixes.
没有魔法在进行,扩展将创建所有后缀的联合操作。
As a protective measure to avoid selecting too many terms, and block redis, which is single threaded, there are two limitations on prefix matching:
作为一种避免选择过多term的保护措施,并且block redis,它是单线程的,前缀匹配有两个限制:
Prefixes are limited to 2 letters or more.
前缀限制为 2 个或更多字母。 You can change this number by using the MINPREFIX setting on the module command line.
您可以使用模块命令行上的 MINPREFIX 设置更改此数字。
Expansion is limited to 200 terms or less .
扩展限制为 200 个或更少。 You can change this number by using the MAXEXPANSIONS setting on the module command line.
您可以使用模块命令行上的 MAXEXPANSIONS 设置更改此数字。
See Run-time configuration: MAXEXPANSIONS for how to configure.有关如何配置,请参阅运行时配置:MAXEXPANSIONS 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.