本文介绍了在Apache CouchDB中启用全文本搜索的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已在此处关注博客条目以启用全文搜索 https://developer.ibm.com/dwblog/2015/text-search-apache-couchdb/#.Vly24SCrQbV

I have followed the blog entry here to enable full text search https://developer.ibm.com/dwblog/2015/text-search-apache-couchdb/#.Vly24SCrQbV

我已经正确设置了所有内容,并且还尝试了其他人的docker镜像.

I have everything correctly set up, and have also tried with other peoples docker images.

您如何设置搜索?需要什么文件.

How do you set up a search? What documents are needed.

我用一个文档创建了一个名为cats的数据库

I have created a database called cats with one document

{
  "_id": "6f35d75b476517e2fc0b3eb12c000e72",
  "_rev": "1-c9a6b4734c83287499e8bbd6d1339050",
  "name": "tibbles"
}

还有设计/视图

{
  "_id": "_design/cat_look",
  "_rev": "1-aae457e6edf5e4a3f69357e5a2160fcc",
  "views": {
    "kitty_name": {
     "map": "function (doc) {\n  index(\"kittyName\", doc.name, {\"store\": true});\n}"
     }
   },
  "language": "javascript"
}

如果我转到> http://localhost:15984/cats/_design/cat_look/_search/kitty_name?q = "*"

我知道

{错误":未找到",原因":未找到小猫的名字."}

{"error":"not_found","reason":"kitty_name not found."}

感谢您的帮助,我很失落.

Thanks for any help on this, I am very lost.

推荐答案

Lucene搜索索引的设置与Map Reduce视图的完成方式不同.在您的代码中,您似乎已尝试使用Map Reduce视图.对于Lucene,首先需要设置一个索引:

A Lucene search index is set up differently to how a Map Reduce view is done. In your code, it looks like you've tried to use a Map Reduce view. For Lucene, first you need to set up an index:

{
    "_id": "_design/Cat_look",
    "indexes": {
        "kitty_name": {
            "index": "function(doc){ ... }"
        }
    }
}

就此主题咨询Cloudant的文档: https://console.bluemix.net/docs/services/Cloudant/api/search.html#search

Consult Cloudant's docs on the subject: https://console.bluemix.net/docs/services/Cloudant/api/search.html#search

这篇关于在Apache CouchDB中启用全文本搜索的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-24 13:48