如何使用与阿朗戈REST API全文搜索为我总是得到空的结果? [英] How to use full text search with arango REST API as I'm always getting empty result?
问题描述
在数据阿朗戈:
{
"employees": [
{
"lastName": "Ansari",
"firstName": "Haseb"
},
{
"lastName": "Ansari",
"firstName": "Affan"
},
{
"lastName": "Keshav",
"firstName": "Anil"
}
],
"_id": "test/124518952473",
"_rev": "124518952473",
"_key": "124518952473"
}
索引:
POST 的http://本地主机:8529 / _db / db_test / _api /指数集合=测试
正文:
{
"type" : "fulltext",
"fields" : [
"lastName"
]
}
提醒:
的http://本地主机:8529 / _db / db_test / _api /简单/全文
正文:
{
"collection" : "test",
"attribute" : "lastName",
"query" : "Ansari"
}
我想在我的应用程序中使用REST API进行全文搜索。请帮我在哪里,我错了这里。这是阿朗戈店只是举例一个文档。否则,我将有更多的文件,因此全文搜索。
I want in my application to use REST API for full text search. Please help me where I am going wrong here. And this is one document in arango store just for example. Otherwise, i'll be having more documents hence full-text search.
推荐答案
短:你的指数是不是在你的文档中的字段
Short: Your index is not on a field in your document.
长:
你保存一个文档,它有一个List 员工
,但没有文件姓
- <$ C里面的多数民众赞成$ C>员工但这不会匹配的路径。
Long:
You're saving one document, it has a list employees
, but no document lastname
- thats inside of employees
but this won't match the path.
但是,您可以让你把员工
的全文索引它的工作,那么对象的所有属性员工
会被索引。然后,您无论如何都匹配第一的和的姓。
You can however make it work if you put the fulltext index on employees
, then all attributes of the object employees
will be indexed. You then however will match on first and last name.
如果您想这样做独立的,需要直接匹配这样一个道理:员工[0] .lastName
If you want to do this separate, you need to directly match a token like that:
employees[0].lastName
这篇关于如何使用与阿朗戈REST API全文搜索为我总是得到空的结果?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!