1

I am new to Redissearch-php , i want performs query search on redis with redis search engine (php). i have tried example from this link : http://www.ethanhann.com/redisearch-php/searching/, but its always returning empty array, Please find code example here,

    $document = $bookIndex->makeDocument();

    $document->title->setValue('How to be awesome.');
    $document->author->setValue('Jack');
    $document->price->setValue(9.99);
    $document->stock->setValue(9);

    $bookIndex->add($document);
    return $bookIndex->search('How')->getCount();

Can someone tell me, what i am doing wrong here ?

Guy Korland
  • 9,139
  • 14
  • 59
  • 106
saw
  • 7
  • 3
  • Are you sure your redis instance is running the redisearch module? – Not_a_Golfer Jan 06 '18 at 15:59
  • The code looks correct. As stated, you need to be running redis with the redisearch module. I find the docker image to be a convenient way to get up and running: https://hub.docker.com/r/redislabs/redisearch/ – ethan Jan 06 '18 at 20:12
  • 2
    v0.9.0 now throws an exception with a friendly message when the RediSearch module is not loaded. – ethan Jan 06 '18 at 21:58
  • @Not_a_Golfer i have two instance running in my docker one is for redislabs/redisearch:latest , and second is redis instance. Is there any way to check -> redis is running the redis-search module ? – saw Jan 07 '18 at 07:44
  • @ethan, I have redissearch module running in my local, still i am unable to get result , Can you please suggest way to check redis is running the redissearch module ? – saw Jan 07 '18 at 07:47
  • @saw you just need one instance - the one with redisearch. can you connect to it via redis-cli and run `FT.INFO`? If you get the error `ERR wrong number of arguments for 'FT.INFO' command` this means you are running redisearch properly. If you get an unknown command error - you're not. Also, have you created the index? – Not_a_Golfer Jan 07 '18 at 08:04

0 Answers0