【问题标题】:How to select ArangoSearch-View field from a specific link如何从特定链接中选择 ArangoSearch-View 字段
【发布时间】:2022-08-19 03:28:33
【问题描述】:

给定以下ArangoSearch View 定义,集合col_personcol_hotel 都有一个命名字段f_name

{
  \"cleanupIntervalStep\": 2,
  \"writebufferSizeMax\": 33554432,
  \"commitIntervalMsec\": 1000,
  \"id\": \"291316\",
  \"consolidationPolicy\": {
    \"type\": \"tier\",
    \"segmentsBytesFloor\": 2097152,
    \"segmentsBytesMax\": 5368709120,
    \"segmentsMax\": 10,
    \"segmentsMin\": 1,
    \"minScore\": 0
  },
  \"consolidationIntervalMsec\": 1000,
  \"globallyUniqueId\": \"h506F923AD141/291316\",
  \"links\": {
    \"col_person\": {
      \"analyzers\": [],
      \"fields\": {
        \"f_name\": {
          \"analyzers\": [
            \"arabic_text_analyzer\",
            \"arabic_collation_analyzer\",
            \"identity\",
            \"text_en\"
          ]
        }
      },
      \"includeAllFields\": false,
      \"storeValues\": \"none\",
      \"trackListPositions\": false
    },
    \"col_hotel\": {
      \"analyzers\": [],
      \"fields\": {
        \"f_name\": {
          \"analyzers\": [
            \"arabic_text_analyzer\",
            \"arabic_collation_analyzer\",
            \"text_en\",
            \"identity\"
          ]
        }
      },
      \"includeAllFields\": false,
      \"storeValues\": \"none\",
      \"trackListPositions\": false
    }
  },
  \"writebufferIdle\": 64,
  \"primarySort\": [],
  \"primarySortCompression\": \"lz4\",
  \"writebufferActive\": 0,
  \"storedValues\": [],
  \"type\": \"arangosearch\"
}

问题是,当执行下面的 AQL 查询时,ArangoDB 在两个集合中搜索\'f_name,那么如何只在 col_person.f_name 中搜索而不是在两个集合中搜索。

LET QR1 = (
    FOR doc_asview_global1 IN asview_global1
    SEARCH
    ANALYZER(
        Like(doc_asview_global1.f_name, \"%Regional%\"),\"identity\") OR
    ANALYZER(
        LEVENSHTEIN_MATCH(doc_asview_global1.f_name, \"Regional\",1,true),\"arabic_text_analyzer\") OR
    ANALYZER(
        PHRASE(doc_asview_global1.f_name, \"Regional\"), \"arabic_text_analyzer\")
    LIMIT 10000
    SORT BM25(doc_asview_global1) DESC
    RETURN doc_asview_global1
)

RETURN QR1

    标签: arangodb aql


    【解决方案1】:

    您可以在SEARCH 操作中添加OPTIONS 以指定您感兴趣的集合:

    SEARCH
      ...
      OPTIONS { collections: ["col_person"] }
    

    https://www.arangodb.com/docs/stable/aql/operations-search.html#search-options

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-02-24
      • 2017-12-27
      • 2021-08-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-11-14
      相关资源
      最近更新 更多