微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

{"error":"not_found","re​​ason":"missing"} 在 Windows 上运行 couchdb-lucene 时出错

如何解决{"error":"not_found","re​​ason":"missing"} 在 Windows 上运行 couchdb-lucene 时出错

我在 Windows Server 2019 版本 1809 上运行 CouchDB 和 Couchdb-lucene。

我遵循了链接 https://github.com/rnewson/couchdb-lucene

上记录的所有步骤

我的 CouchDB local.ini 文件

[couchdb]
os_process_timeout = 60000

[external]
fti=D:/Python/python.exe "C:/couchdb-lucene-2.2.0/tools/couchdb-external-hook.py --remote-port 5986"

[httpd_db_handlers]
_fti = {couch_httpd_external,handle_external_req,<<"fti">>}

[httpd_global_handlers]
_fti = {couch_httpd_proxy,handle_proxy_req,<<"http://127.0.0.1:5986">>}

couchdb-lucene.ini 文件

[lucene]
# The output directory for Lucene indexes.
dir=indexes

# The local host name that couchdb-lucene binds to
host=localhost

# The port that couchdb-lucene binds to.
port=5986

# Timeout for requests in milliseconds.
timeout=10000

# Timeout for changes requests.
# changes_timeout=60000

# Default limit for search results
limit=25

# Allow leading wildcard?
allowLeadingWildcard=false

# couchdb server mappings

[local]
url = http://localhost:5984/

卷曲输出

C:\Users\serhato>curl http://localhost:5986/_fti
{"couchdb-lucene":"Welcome","version":"2.2.0-SNAPSHOT"}

C:\Users\serhato>curl http://localhost:5984
{"couchdb":"Welcome","version":"3.1.1","git_sha":"ce596c65d","uuid":"cc1269d5a23b98efa74a7546ba45f1ab","features":["access-ready","partitioned","pluggable-storage-engines","reshard","scheduler"],"vendor":{"name":"The Apache Software Foundation"}}

我在 CouchDB 中定义的设计文档,旨在为 RenderedMessage 字段创建全文搜索索引

{
  "_id": "_design/foo","_rev": "11-8ae842420bb4e122514fea6f05fac90c","fulltext": {
    "by_message": {
      "index": "function(doc) { var ret=new Document(); ret.add(doc.RenderedMessage); return ret }"
    }
  }
}

当我导航到 http://localhost:5984/dev-request-logs/_fti/_design/foo/by_message?q=hello

回复

{"error":"not_found","reason":"missing"}

当我也导航 http://localhost:5984/dev-request-logs/_fti/ 响应相同

{"error":"not_found","reason":"missing"}

我认为与 lucene 引擎的外部集成存在问题。所以为了我的粗心,我尝试执行 python 命令来检查 py 脚本是否正在运行。

D:/Python/python.exe C:/couchdb-lucene-2.2.0/tools/couchdb-external-hook.py

但结果是

C:\Users\serhato>D:/Python/python.exe C:/couchdb-lucene-2.2.0/tools/couchdb-external-hook.py 文件“C:\couchdb-lucene-2.2.0\tools\couchdb-external-hook.py”,第 43 行 除了例外,e: ^ 语法错误:无效语法

可能是什么问题?

解决方法

经过几个小时的搜索,我终于进入了这个链接

https://github.com/rnewson/couchdb-lucene/issues/265

查询必须直接通过 Lucene 而不是 coucbdb 本身。以下网址返回结果

C:\Users\serhato>curl http://localhost:5986/localx/dev-requestlogs/_design/foo/by_message?q=hello

原始文档非常具有误导性,因为所有示例都使用 couchdb 默认端口而不是 Lucene。

还是我遗漏了什么??

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。