sea-team / gofound

GoFound GoLang Full text search go语言全文检索引擎,毫秒级查询。 使用http接口调用,集成Admin管理界面,任何系统都可以使用。

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

remove return 404 Not found

zhangchunlin opened this issue · comments

gofound revision: 59d4e00
gofound-python revision: e170d832a486c3588ddb7e61a0c84eea9e99829b

Use python script in https://github.com/newpanjing/gofound-python/blob/master/README.md, got:

$ python test.py
{'state': True, 'message': 'success'}
{'state': True, 'message': 'success', 'data': {'time': 33.977121, 'total': 1, 'pageCount': 1, 'page': 1, 'limit': 10, 'documents': [{'id': 1000, 'text': '探访海南自贸港“样板间”', 'document': {'content': '洋浦经济开发区地处海南西北部洋浦半岛,是21世纪海上丝绸之路与西部陆海新通道的交汇节点。是国务院1992年批准设立的。我国第一个由外商成片开发、享受保税区政策的国家级开发区'}, 'score': 3, 'keys': ['海南', '自贸港', '样板', '样板间', '探访']}], 'words': ['探访', '海南', '自贸港']}}
{'id': 1000, 'text': '探访海南自贸港“样板间”', 'document': {'content': '洋浦经济开发区地处海南西北部洋浦半岛,是21世纪海上丝绸之路与西部陆海新通道的交汇节点。是国务院1992年批准设立的。我国第一个由外商成片开发、享受保税区政策的国家级开发区'}, 'score': 3, 'keys': ['海南', '自贸港', '样板', '样板间', '探访']}
Traceback (most recent call last):
  File "test.py", line 46, in <module>
    remove()
  File "test.py", line 39, in remove
    res = client.remove_document(1000)
  File "/home/zhangclb/sandbox/gofound/gofound-python/gofound/client.py", line 78, in remove_document
    res = self._post("remove", json={
  File "/home/zhangclb/sandbox/gofound/gofound-python/gofound/client.py", line 43, in _post
    raise DBException("Error:", res.status_code)
gofound.exceptions.DBException: ('Error:', 404)

Then access http://localhost:8080/admin/#/ , query with "海南",
sent:

{
  "query": "海南",
  "page": 1,
  "limit": 10,
  "highlight": {
    "preTag": "<em style='color:red'>",
    "postTag": "</em>"
  },
  "order": "DESC"
}

got:
{"state":true,"message":"success","data":{"time":0.38622900000000004,"total":1,"pageCount":1,"page":1,"limit":10,"documents":[{"id":1000,"text":"探访\u003cem style='color:red'\u003e海南\u003c/em\u003e自贸港“样板间”","document":{"content":"洋浦经济开发区地处海南西北部洋浦半岛,是21世纪海上丝绸之路与西部陆海新通道的交汇节点。是国务院1992年批准设立的。我国第一个由外商成片开发、享受保税区政策的国家级开发区"},"originalText":"探访海南自贸港“样板间”","score":1,"keys":["海南","自贸港","样板","样板间","探访"]}],"words":["海南"]}}

But remove failed, sent:
{id: 1000}
But got 404:

请求网址: http://localhost:8080/api/remove?database=default
请求方法: POST
状态代码: 404 Not Found
远程地址: 127.0.0.1:8080
引荐来源网址政策: strict-origin-when-cross-origin

好像是文档写错了,得用 index/remove

db/drop 也有问题

注意上面说的api调用返回404问题是发生在 gofound 内置的 /admin 管理网站上的,所以应该是需要修改内置管理网站,因为学习gofound的api使用是大概率会参考内置管理网站的。

@newpanjing There is another PR for gofound-python, please also help to review.