Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

id can't be non bigint #501

Closed
githubmanticore opened this issue Feb 17, 2021 · 1 comment
Closed

id can't be non bigint #501

githubmanticore opened this issue Feb 17, 2021 · 1 comment
Labels

Comments

@githubmanticore
Copy link
Contributor

If you define id as sql_attr_uint in config:

snikolaev@dev:~$ cat min_id.conf 
source min { 
    type = mysql 
    sql_host = localhost 
    sql_user = test 
    sql_pass = 
    sql_db = test 
    sql_query = select 1 id, 'dog' doc 
    sql_field_string = doc 
    sql_attr_uint = id 
} 
 
index idx { 
    path = idx 
    source = min 
} 
 
searchd { 
    listen = 127.0.0.1:9315:mysql41 
    log = sphinx_min.log 
    pid_file = /home/snikolaev/9315.pid 
    binlog_path = 
} 

build the index:

snikolaev@dev:~$ indexer -c min_id.conf --all 
Manticore 3.5.4 13f8d08@201211 release 
Copyright (c) 2001-2016, Andrew Aksyonoff 
Copyright (c) 2008-2016, Sphinx Technologies Inc (http://sphinxsearch.com) 
Copyright (c) 2017-2020, Manticore Software LTD (http://manticoresearch.com) 
 
using config file 'min_id.conf'... 
indexing index 'idx'... 
collected 1 docs, 0.0 MB 
creating lookup: 0.0 Kdocs, 100.0% done 
creating histograms: 0.0 Kdocs, 100.0% done 
sorted 0.0 Mhits, 100.0% done 
total 1 docs, 3 bytes 
total 0.179 sec, 16 bytes/sec, 5.55 docs/sec 
total 4 reads, 0.000 sec, 8.0 kb/call avg, 0.0 msec/call avg 
total 15 writes, 0.000 sec, 0.0 kb/call avg, 0.0 msec/call avg 

and try to search in it - it hangs:

snikolaev@dev:~$ mysql -P9315 -h0 
Welcome to the MySQL monitor.  Commands end with ; or \g. 
Your MySQL connection id is 395 
Server version: 3.5.4 13f8d08@201211 release git branch HEAD (no branch) 
 
Copyright (c) 2000, 2021, Oracle and/or its affiliates. 
 
Oracle is a registered trademark of Oracle Corporation and/or its 
affiliates. Other names may be trademarks of their respective 
owners. 
 
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. 
 
mysql> select * from idx; 

The expected behaviour is that indexer just doesn't let you build an index with a wrong id.

As said in the manual :

Document ID MUST be the very first field, and it MUST BE UNIQUE UNSIGNED POSITIVE (NON-ZERO, NON-NEGATIVE) INTEGER NUMBER.

Otherwise an error should be generated.

@githubmanticore
Copy link
Contributor Author

➤ Ilya Kuznetsov commented:

Works fine for me as of eb61315:

Manticore 5.0.3 58d6038fb@230114 dev (columnar 1.16.1 7fec1ab@230114) (secondary 1.16.1 7fec1ab@230114) 
Copyright (c) 2001-2016, Andrew Aksyonoff 
Copyright (c) 2008-2016, Sphinx Technologies Inc (http://sphinxsearch.com) 
Copyright (c) 2017-2023, Manticore Software LTD (https://manticoresearch.com) 
 
using config file './manticore.conf'... 
indexing table 'idx'... 
collected 1 docs, 0.0 MB 
creating secondary index 
creating lookup: 0.0 Kdocs, 100.0% done 
sorted 0.0 Mhits, 100.0% done 
total 1 docs, 3 bytes 
total 0.104 sec, 28 bytes/sec, 9.52 docs/sec 
total 3 reads, 0.000 sec, 0.0 kb/call avg, 0.0 msec/call avg 
total 17 writes, 0.000 sec, 0.0 kb/call avg, 0.0 msec/call avg 
mysql> select * from idx; 
+------+------+ 
| id   | doc  | 
+------+------+ 
|    1 | dog  | 
+------+------+ 
1 row in set (0.00 sec) 
 
mysql> desc idx; 
+-------+--------+----------------+ 
| Field | Type   | Properties     | 
+-------+--------+----------------+ 
| id    | bigint |                | 
| doc   | text   | indexed stored | 
| doc   | string |                | 
+-------+--------+----------------+ 
3 rows in set (0.00 sec) 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant