front / redisearch

CMS/Framework agnostic RediSearch Client
MIT License
20 stars 7 forks source link

doc creation OK, search not OK. #2

Closed lhoumeau closed 4 years ago

lhoumeau commented 4 years ago

For tests, I'm following the example provided in the package.

My redisearch run on a docker container on a separated instance (tests are done on local ubuntu instances, with OSX Parallels).

Connection, schema creation, document creation are OK : I can list keys with redis-cli and an hgetall gives me the doc fields and values. For example:

(ip_instance):6379> hgetall 15f730837e3d3a 1) "title" 2) "Document title like post title" 3) "content" 4) "This is a lightweight implementation of redisearch" 5) "permalink" 6) "https://testlenke.no" 7) "category" 8) "search, fuzzy, synonym, phonetic" 9) "date" 10) "1547424720" 11) "location" 12) "-77,0366 38,8977"

But the search is not effective :

    $search = new Query( $client, 'test' );
    $results = $search->search('title');
    echo $results->getCount();             // => 0

An idea? Thx in advance

The redisearch instance :

$ docker run -p 6379:6379 redislabs/redisearch:latest 1:C 28 Sep 2020 19:43:43.105 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo 1:C 28 Sep 2020 19:43:43.105 # Redis version=6.0.5, bits=64, commit=00000000, modified=0, pid=1, just started 1:C 28 Sep 2020 19:43:43.105 # Configuration loaded 1:M 28 Sep 2020 19:43:43.107 Running mode=standalone, port=6379. 1:M 28 Sep 2020 19:43:43.107 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128. 1:M 28 Sep 2020 19:43:43.107 # Server initialized 1:M 28 Sep 2020 19:43:43.107 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect. 1:M 28 Sep 2020 19:43:43.107 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled. 1:M 28 Sep 2020 19:43:43.113 Redis version found by RedisSearch : 6.0.5 - oss 1:M 28 Sep 2020 19:43:43.114 RediSearch version 2.0.0 (Git=v1.99.5-17-gd421035) 1:M 28 Sep 2020 19:43:43.114 Low level api version 1 initialized successfully 1:M 28 Sep 2020 19:43:43.114 concurrent writes: OFF, gc: ON, prefix min length: 2, prefix max expansions: 200, query timeout (ms): 500, timeout policy: return, cursor read size: 1000, cursor max idle (ms): 300000, max doctable size: 1000000, max number of search results: 1000000, search pool size: 20, index pool size: 8, 1:M 28 Sep 2020 19:43:43.114 Initialized thread pool! 1:M 28 Sep 2020 19:43:43.114 Module 'search' loaded from /usr/lib/redis/modules/redisearch.so 1:M 28 Sep 2020 19:43:43.114 Ready to accept connections

foadyousefi commented 4 years ago

Thanks for reporting.

Which version of RediSearch you are using? They have recently released version 2.0 which this package still not tested with.

I run the exact same example and I've got results. Pay attention to line 57 in the example.php file. It has been commented, you need to uncomment this line in order for the document to be indexed. (Since you are getting results by running hgetall, I assume you have done this?)

Can you run FT.SEARCH test Document in your redis-cli and let me know what is the results?

lhoumeau commented 4 years ago

Thx for answer.

FT.SEARCH test Document
1) (integer) 0

According to docker container boot sequence, it's RediSearch version 2.0.0. Maybe I can run a container with a lower version. I will try and come back (hoping with good news ;-).

Do you plan to align the repo src with RediSearch 2.0 ?

lhoumeau commented 4 years ago

Tried with RediSearch 1.8.3. Now OK !

Note: issues with geo value : "Could not index geo value" throw by $index->add($document)

Which version of RediSearch is required?

Regards

foadyousefi commented 4 years ago

Thanks for reporting the incompatibility issue.

In our tests, we used version 1.6.6 (a bit old). We are using RediSearch in production, so we will update this repo as well.

I will make sure to do this as soon as possible and will let you know when version 2.0 support is ready.

lhoumeau commented 4 years ago

Thank you very much for your help and answers. I can go further in my tests.

Please keep me inform.

foadyousefi commented 4 years ago

@lhoumeau

Version 2.0 support added.

Can I ask what is your use case? Because the company I'm working with Frontkom is maintaining plugin for Wordpress plugin and Drupal module for RediSearch. We are using both in production with great success.