我试图了解如何在 Redisearch 中严格使用“开头”来执行查询,并且我不断得到“包含”。
例如,如果我的字段具有诸如'football'、'myfootball'、'greenfootball'之类的值,并且会提供如下搜索词:
> FT.SEARCH myIdx @myfield:foot*
我只想获得“足球”,但我不断获得包含该单词而不是以该单词开头的其他字段。
有没有办法避免这种情况?
我试图使用VERBATIM
和类似的东西,@myfield:^foot*
但没有。
我使用 JRedisearch 作为客户端,但最终我不得不输入数据库并手动执行这些查询,以便弄清楚发生了什么。话虽如此,目前这可能与该客户有关吗?
谢谢
编辑 我的索引设置示例:
Client client = new Client(INDEX_NAME, url, PORT);
Schema sc = new Schema().addSortableTextField("url", 1.0); // using this field for query
client.dropIndex(true);
client.createIndex(sc, Client.IndexOptions.Default());
return client;
样本文件:
id: // random uuid
urlPath: myfootbal
application: web
market: Europe