简体   繁体   English

ArangoDB 通配符搜索很慢

[英]ArangoDB wildcard search is slow

I am working on the below query and trying to implement an ArangoDB wildcard search.我正在处理以下查询并尝试实现 ArangoDB 通配符搜索。 The criteria is very simple, I'd like to match records similar to the name or a number field and limit the records to 25. The query works but is very slow, taking upwards of 30seconds.条件非常简单,我想匹配类似于名称或数字字段的记录,并将记录限制为 25 条。查询有效但非常慢,需要 30 秒以上。 The goal is to optimize this query and get it as close to sub second as possible.目标是优化此查询并使其尽可能接近亚秒级。 I'd like the query to function similar to how a MySQL LIKE would work, matching using the % wildcard on both sides.我希望对 function 的查询类似于 MySQL LIKE 的工作方式,在两边都使用 % 通配符进行匹配。

https://www.arangodb.com/docs/stable/release-notes-new-features37.html#wildcard-search https://www.arangodb.com/docs/stable/release-notes-new-features37.html#wildcard-search

Note, one thing I noticed is that in the release note examples, rather than using FILTER, they are using SEARCH.请注意,我注意到的一件事是,在发行说明示例中,他们使用的是 SEARCH,而不是使用 FILTER。

Additional info:附加信息:

  • name is alphanumeric名称是字母数字
  • number is going to by an 8 digit number数字将由 8 位数字组成
LET str = CONCAT("%", 'test', '%")
LET search = (
   FOR doc IN name_search
   FILTER ANALYZER(doc.name LIKE str, "text_en") OR
   FILTER ANALYZER(doc.number LIKE str, "text_en")
   LIMIT 25
   RETURN doc
)
RETURN SEARCH

FILTER doesn't utilize indices. FILTER 不使用索引。 To speedup your wildcard queries you have to create an ArangoSearch view over a collection and use SEARCH keyword.要加快通配符查询,您必须在集合上创建 ArangoSearch 视图并使用 SEARCH 关键字。

Feel free to check the following interactive tutorial (see "LIKE Support" section): https://www.arangodb.com/learn/search/arangosearch-tutorial-3-7/随意查看以下互动教程(参见“LIKE Support”部分): https://www.arangodb.com/learn/search/arangosearch-tutorial-3-7/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM