1

我在 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: ^ SyntaxError: invalid syntax

可能是什么问题?

4

1 回答 1

1

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

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

查询必须直接通过 Lucene 而不是 coucbdb 本身。下面的 url 返回结果

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

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

还是我错过了什么?

于 2021-02-27T18:30:44.617 回答