Open zepen opened 5 days ago
The fuzzy option is not released yet. Please use the dev version https://mnt.cr/dev/nightly
thanks! but old tables how to set min_infix_len
ERROR 1064 (42000): Fuzzy plugin requires min_infix_len to be set
and python sdk have error
2024-09-22 16:04:01.048 | ERROR | manticore_search:search_by_sql:31 - manticore-search-error:search-by-sql:0
but old tables how to set min_infix_len
Use ALTER TABLE
Note, it will affect only new documents. For full reindexing of the table you can use mysqldump - mysqldump -etc --replace ...
.
and python sdk have error
What's the code?
but old tables how to set min_infix_len
Use ALTER TABLE
Note, it will affect only new documents. For full reindexing of the table you can use mysqldump -
mysqldump -etc --replace ...
.and python sdk have error
What's the code?
import manticoresearch
from manticoresearch.rest import ApiException
from manticore_search import ManticoreSearch
from loguru import logger
class ManticoreSearch:
def __init__(self, host, logger):
self._logger = logger
configuration = manticoresearch.Configuration(host=host)
api_client = manticoresearch.ApiClient(configuration)
self.index_api = manticoresearch.IndexApi(api_client)
self.search_api = manticoresearch.SearchApi(api_client)
self.utils_api = manticoresearch.UtilsApi(api_client)
manticore_search = ManticoreSearch("127.0.0.1:9308", logger)
sql = """select * from my_index where match('temu') OPTION fuzzy=1 layouts='us,uk' distance=2;"""
manticore_search.utils_api.sql(sql)
but have error :
{'error': "P01: syntax error, unexpected $end near ', '"}
single run sql its work well when i use mysql -P9306 -h0
login systems
Can't reproduce your error, but I had to remove from manticore_search import ManticoreSearch
from your script:
snikolaev@dev2:~$ pip install manticoresearch loguru
Defaulting to user installation because normal site-packages is not writeable
Collecting manticoresearch
Using cached manticoresearch-4.0.0-py3-none-any.whl (112 kB)
Requirement already satisfied: loguru in ./.local/lib/python3.10/site-packages (0.7.2)
Requirement already satisfied: urllib3>=1.15 in /usr/lib/python3/dist-packages (from manticoresearch) (1.26.5)
Requirement already satisfied: six>=1.10 in /usr/lib/python3/dist-packages (from manticoresearch) (1.16.0)
Requirement already satisfied: certifi in /usr/local/lib/python3.10/dist-packages (from manticoresearch) (2024.7.4)
Requirement already satisfied: python-dateutil in ./.local/lib/python3.10/site-packages (from manticoresearch) (2.8.2)
Installing collected packages: manticoresearch
Successfully installed manticoresearch-4.0.0
[notice] A new release of pip is available: 23.1.2 -> 24.2
[notice] To update, run: python -m pip install --upgrade pip
snikolaev@dev2:~$ cat 2581.py
import manticoresearch
from manticoresearch.rest import ApiException
from loguru import logger
class ManticoreSearch:
def __init__(self, host, logger):
self._logger = logger
configuration = manticoresearch.Configuration(host=host)
api_client = manticoresearch.ApiClient(configuration)
self.index_api = manticoresearch.IndexApi(api_client)
self.search_api = manticoresearch.SearchApi(api_client)
self.utils_api = manticoresearch.UtilsApi(api_client)
manticore_search = ManticoreSearch("127.0.0.1:9308", logger)
sql = """select * from my_index where match('temu') OPTION fuzzy=1 layouts='us,uk' distance=2;"""
manticore_search.utils_api.sql(sql)
snikolaev@dev2:~$ mysql -P9306 -h0 -e "drop table if exists my_index; create table my_index(f text) min_infix_len='2';"
snikolaev@dev2:~$ python3 2581.py
Please provide a better instruction how to reproduce the issue.
My versions are:
snikolaev@dev2:~$ searchd -v
Manticore 6.3.7 53ae190b8@24091306 dev (columnar 2.3.1 f9ef8b9@24090411) (secondary 2.3.1 f9ef8b9@24090411) (knn 2.3.1 f9ef8b9@24090411)
snikolaev@dev2:~$ python3 --version
Python 3.10.12
Can't reproduce your error, but I had to remove
from manticore_search import ManticoreSearch
from your script:snikolaev@dev2:~$ pip install manticoresearch loguru Defaulting to user installation because normal site-packages is not writeable Collecting manticoresearch Using cached manticoresearch-4.0.0-py3-none-any.whl (112 kB) Requirement already satisfied: loguru in ./.local/lib/python3.10/site-packages (0.7.2) Requirement already satisfied: urllib3>=1.15 in /usr/lib/python3/dist-packages (from manticoresearch) (1.26.5) Requirement already satisfied: six>=1.10 in /usr/lib/python3/dist-packages (from manticoresearch) (1.16.0) Requirement already satisfied: certifi in /usr/local/lib/python3.10/dist-packages (from manticoresearch) (2024.7.4) Requirement already satisfied: python-dateutil in ./.local/lib/python3.10/site-packages (from manticoresearch) (2.8.2) Installing collected packages: manticoresearch Successfully installed manticoresearch-4.0.0 [notice] A new release of pip is available: 23.1.2 -> 24.2 [notice] To update, run: python -m pip install --upgrade pip
snikolaev@dev2:~$ cat 2581.py import manticoresearch from manticoresearch.rest import ApiException from loguru import logger class ManticoreSearch: def __init__(self, host, logger): self._logger = logger configuration = manticoresearch.Configuration(host=host) api_client = manticoresearch.ApiClient(configuration) self.index_api = manticoresearch.IndexApi(api_client) self.search_api = manticoresearch.SearchApi(api_client) self.utils_api = manticoresearch.UtilsApi(api_client) manticore_search = ManticoreSearch("127.0.0.1:9308", logger) sql = """select * from my_index where match('temu') OPTION fuzzy=1 layouts='us,uk' distance=2;""" manticore_search.utils_api.sql(sql)
snikolaev@dev2:~$ mysql -P9306 -h0 -e "drop table if exists my_index; create table my_index(f text) min_infix_len='2';" snikolaev@dev2:~$ python3 2581.py
Please provide a better instruction how to reproduce the issue.
My versions are:
snikolaev@dev2:~$ searchd -v Manticore 6.3.7 53ae190b8@24091306 dev (columnar 2.3.1 f9ef8b9@24090411) (secondary 2.3.1 f9ef8b9@24090411) (knn 2.3.1 f9ef8b9@24090411) snikolaev@dev2:~$ python3 --version Python 3.10.12
My version:
Manticore 6.3.7 d938571ca@24091913 dev (columnar 2.3.1 f9ef8b9@24090411) (secondary 2.3.1 f9ef8b9@24090411) (knn 2.3.1 f9ef8b9@24090411)
Copyright (c) 2001-2016, Andrew Aksyonoff
Copyright (c) 2008-2016, Sphinx Technologies Inc (http://sphinxsearch.com)
Copyright (c) 2017-2024, Manticore Software LTD (https://manticoresearch.com)
Python 3.11.4
And python code:
import manticoresearch
from manticoresearch.rest import ApiException
from loguru import logger
class ManticoreSearch:
def __init__(self, host, logger):
self._logger = logger
configuration = manticoresearch.Configuration(host=host)
api_client = manticoresearch.ApiClient(configuration)
self.index_api = manticoresearch.IndexApi(api_client)
self.search_api = manticoresearch.SearchApi(api_client)
self.utils_api = manticoresearch.UtilsApi(api_client)
manticore_search = ManticoreSearch("127.0.0.1:9308", logger)
sql = """select * from test_index where match('temu') OPTION fuzzy=1 layouts='us,uk' distance=2;"""
data = manticore_search.utils_api.sql(sql)
print(data)
build test-index like this:
mysql -P9306 -h0 -e "drop table if exists test_index; create table test_index(f text) min_infix_len='2';"
python script name same with u
logs show:
python 2518.py
{'error': "P01: syntax error, unexpected $end near ', '"}
In python core, It wasn't queried correctly. Maybe the SQL statement cannot be parsed.
3 questions:
select * from test_index where match('temu') OPTION fuzzy=1 layouts='us,uk' distance=2;
works via mysql client and doesn't work via the python client (and probably /sql
)mysql> select * from test_index where match('temu') OPTION fuzzy=1 layouts='us,uk' distance=2;
Empty set (0.01 sec)
layouts='us,uk'
from the sql query it doesn't fail via the python client@donhardman as discussed, pls try to answer the above questions.
Proposal:
run sql as below
version as below
but logs outputs:
Checklist:
To be completed by the assignee. Check off tasks that have been completed or are not applicable.