简体   繁体   English

如何使用aql,blueprints和http接口在arangodb图中进行全文查询?

[英]How to do a fulltext query within a arangodb graph with aql, blueprints and http interface?

Say, I have vertices with the property "text" and a fulltext index for this property. 比方说,我有属性“text”的顶点和这个属性的全文索引。

In the arango 2.1.2 shell, I can query the vertices with 在arango 2.1.2 shell中,我可以查询顶点

g._vertices.fulltext("text","my text value")

or db.v.fulltext("text","my text value") db.v.fulltext("text","my text value")

But if I use blueprints-arangodb-graph-1.0.8, the request which the blueprint implementation fires looks like 但是如果我使用blueprints-arangodb-graph-1.0.8,那么蓝图实现的请求就像是

http://{arangodb}/_db/testdb/_api/graph/test_graph/vertices

with the body: 与身体:

{"batchSize":1,"count":false,"filter":{"properties":[{"key":"text","value":"my text value":"=="}]}}

This is extremely inefficient because it iterates over every vertex. 这是非常低效的,因为它遍历每个顶点。

So, is it possible to do the query efficient in 那么,是否可以有效地进行查询

  • aql AQL
  • blueprints 蓝图
  • and http interface? 和http接口?

Many thanks. 非常感谢。

UPDATE: I found the simple fulltext query via HTTP 更新:我通过HTTP找到了简单的全文查询

http://{arangodb}/_db/testdb/_api/simple/fulltext

and body: 和身体:

{ "collection": "test_vertices", "attribute" : "text", "query" : "my text value" }

UPDATE-2 I found the AQL: UPDATE-2我找到了AQL:

FOR v in FULLTEXT(test_vertices, 'text', 'my text value') RETURN v

Let's say your collection is called "vertices" and your attribute is "text". 假设您的集合称为“顶点”,您的属性为“文本”。

In AQL you can use "FULLTEXT" (see http://docs.arangodb.org/Aql/Operators.html ): 在AQL中,您可以使用“FULLTEXT”(请参阅http://docs.arangodb.org/Aql/Operators.html ):

arangosh [_system]> db._query("return FULLTEXT(vertices, 'text', 'hallo')").toArray()
[ 
  [ 
    { 
      "_id" : "vertices/268953710", 
      "_rev" : "268953710", 
      "_key" : "268953710", 
      "text" : "hallo hugo" 
    }, 
    { 
      "_id" : "vertices/269150318", 
      "_rev" : "269150318", 
      "_key" : "269150318", 
      "text" : "hallo emil" 
    }, 
    { 
      "_id" : "vertices/268757102", 
      "_rev" : "268757102", 
      "_key" : "268757102", 
      "text" : "hallo world" 
    } 
  ] 
]

For HTTP you can either use HTTP interface for AQL and the the above FULLTEXT function. 对于HTTP,您可以使用AQL的HTTP接口和上面的FULLTEXT函数。

Alternatively you can use the "PUT /_api/simple/fulltext" endpoint and execute the fulltext search directly (see http://docs.arangodb.org/HttpSimpleQuery/README.html ). 或者,您可以使用“PUT / _api / simple / fulltext”端点并直接执行全文搜索(请参阅http://docs.arangodb.org/HttpSimpleQuery/README.html )。

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

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