简体   繁体   English

ArangoSearch 支持多字段搜索

[英]ArangoSearch support for multiple fields search

Does ArangoSearch support search on multiple/all fields of a collection. ArangoSearch 是否支持对集合的多个/所有字段进行搜索。 I want to be able to search a text on all fields of a given collection.我希望能够在给定集合的所有字段上搜索文本。 Does ArangoSearch support such a thing? ArangoSearch 是否支持这样的事情?

You can let a View index all fields (attributes) of your documents very easily:您可以让 View 非常轻松地索引文档的所有字段(属性):

{
  "links": {
    "yourCollection": {
      "includeAllFields": true
    }
  },
  …
}

In queries you need to be explicit about which fields to search in however:但是,在查询中,您需要明确要搜索哪些字段:

FOR doc IN yourView
  SEARCH doc.field1 == "foo" OR doc.field2 == "foo" OR doc.nested.field == "foo"
  RETURN doc

It is not possible (yet) to express this using a wildcard, like SEARCH doc.* == "foo" .使用通配符(例如SEARCH doc.* == "foo" )来表达这一点(还)是不可能的。 Possible workarounds are to maintain a separate attribute which combines the content of all the individual fields you want to search in (but you need to make sure that it stays in sync with the source attributes), or to use a query builder of sorts to generate a disjunction like above.可能的解决方法是维护一个单独的属性,该属性组合了您要搜索的所有单个字段的内容(但您需要确保它与源属性保持同步),或者使用各种查询构建器来生成像上面这样的分离。

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

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