使用Couchbase服务器3.0和端口8092查找相似的名称 [英] Find similar names using Couchbase server 3.0 and port 8092
问题描述
我想使用Couchbase服务器找到类似的位置名称.我创建了如下索引
功能(文档,元数据){发出(doc.loc_name,doc);}
这就是我查询数据的方式
http://IP地址:8092/dev-locations/_design/dev_test_view/_view/searchByLocationName?full_set = true& inclusive_end = true& stale = false& connection_timeout = 60000& key =%22Joh%22
但这仅在找到完全匹配的情况下才会返回.我正在寻找的是当我发送密钥 joh
时,它应该返回 johenaskirchen
和 johenasberg
(与我们在MySQL中的LIKE相同)>
任何帮助将不胜感激.
注意:我已经尝试过N1QL,我正在寻找在没有N1QL的情况下实现此目的的方法
key
参数完全匹配.您想要的是 startKey
和 endKey
的组合:
?startkey =%22joh%22& endkey =%22joh \ uefff%22
\ uefff
是一个技巧,此unicode字符可以看作是最大字符",因此可以确保在 johzzzzzz
之类的键下仍可以考虑 joh \ uefff
的上限(包括 endkey
).
I want to find the similar location names using couchbase server. i created an index as follows
function (doc, meta) {
emit(doc.loc_name, doc);
}
this is how i query data
http://IP Address:8092/dev-locations/_design/dev_test_view/_view/searchByLocationName?full_set=true&inclusive_end=true&stale=false&connection_timeout=60000&key=%22Joh%22
But this will return only if the exact match found. What i am looking for is when i send the key joh
, it should return johenaskirchen
and johenasberg
(same as our LIKE in MySQL)
Any help will be highly appreciated.
Note : I already tried N1QL and i am looking for ways to implement this without N1QL
the key
parameter is an exact match. What you want is a combination of startKey
and endKey
:
?startkey=%22joh%22&endkey=%22joh\uefff%22
The \uefff
is a trick, this unicode character can be seen as "the biggest character" so it ensures that a key like johzzzzzz
will still be considered under the upper bound of joh\uefff
(endkey
is inclusive).
这篇关于使用Couchbase服务器3.0和端口8092查找相似的名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!