如何在 Cloudant 搜索索引中启用部分搜索和忽略大小写?
How would I enable partial search and case ignore in Cloudant Search Index?
搜索功能
function (doc) {
for(var j =1;j<doc.sheets[1].data.length;j++){
index("Name", doc.sheets[1].data[j]);
}
}
我的分析仪是标准的。怎么修改这个函数才能实现部分匹配的搜索
您应该能够使用 *
和其他特殊字符作为查询语法的一部分来执行通配符搜索、模糊搜索等。
来自 https://console.bluemix.net/docs/services/Cloudant/api/search.html#query-syntax:
If you want a fuzzy search, you can run a query with ~
to find terms like the search term. For instance, look~
finds the terms book
and took
.
和
Wildcard searches are supported, for both single (?
) and multiple (*
) character searches. For example, dat?
would match date
and data
, whereas dat*
would match date
, data
, database
, and dates
.
搜索功能
function (doc) {
for(var j =1;j<doc.sheets[1].data.length;j++){
index("Name", doc.sheets[1].data[j]);
}
}
我的分析仪是标准的。怎么修改这个函数才能实现部分匹配的搜索
您应该能够使用 *
和其他特殊字符作为查询语法的一部分来执行通配符搜索、模糊搜索等。
来自 https://console.bluemix.net/docs/services/Cloudant/api/search.html#query-syntax:
If you want a fuzzy search, you can run a query with
~
to find terms like the search term. For instance,look~
finds the termsbook
andtook
.
和
Wildcard searches are supported, for both single (
?
) and multiple (*
) character searches. For example,dat?
would matchdate
anddata
, whereasdat*
would matchdate
,data
,database
, anddates
.