lucene 从变量开始搜索的Cloudant搜索查询

ruarlubt  于 2022-11-07  发布在  Lucene
关注(0)|答案(1)|浏览(227)

我在cloudant数据库中有以下内容

`{
  "_id": "72b48c107bda43827bcfba8761f00cf4",
  "_rev": "1-2c4246347f215ef82f4372659249c412",
  "delivery_id": 321,
  "purchase_item": "Paint"
 }`

`{
  "_id": "72b48c107bda43827bcfba8761f00cf4",
  "_rev": "1-2c4246347f215ef82f4372659249c412",
  "delivery_id": 528,
  "purchase_item": "Glass"
 }`

我有以下索引:

`function (doc) {
   index("deliveryid", doc.delivery_id,  {"store":true});
   index("purchaseitem", doc.purchase_item,  {"store":true});
 }`

我想使用deliveryid进行搜索,但该值来自一个变量。例如,value = 321
如何在下面的搜索查询中使用“value”?query = "_design/app/_search/_delivery_id/?query=deliveryid"

mfpqipee

mfpqipee1#

看起来您正在构建URL字符串,因此将变量连接到查询中(注意name:value Lucene语法)

query = "_design/app/_search/_delivery_id/?query=deliveryid:" + value

相关问题