Skip to content

I got ERR unknown command FT.CREATE error when creating an index ? #63

Open
@sergeynilov

Description

@sergeynilov

I added macfja/redisearch ^2.2 to my laravel 9.48 app and got errors :

ERR unknown command `FT.CREATE`, with args beginning with: `articleIndices`, `SCHEMA`, `title`, `TEXT`, `SORTABLE`,
when creating index with code:

    public function createIndex(): self
    {
        $clientFacade = new ClientFacade();
        \Log::info(varDump($clientFacade, ' -1 createIndex $clientFacade::'));
        $redisClient =  $clientFacade->getClient(new \Predis\Client(/* ... */));
        $builder = new \MacFJA\RediSearch\IndexBuilder();
        \Log::info(varDump($builder, ' -1 $builder::'));

        $builder
            ->setIndex('articleIndices')
            ->addTextField('title', false, null, null, true)
            ->create($redisClient);  // Error pointing at this line

Making dumps of 2 vars above I see in log file :

[2023-02-24 07:42:12] local.INFO:  (Object of MacFJA\RediSearch\Redis\Client\ClientFacade) : -1 createIndex $clientFacade:: : Array
(
    [ MacFJA\RediSearch\Redis\Client\ClientFacade factories] => Array
        (
            [0] => MacFJA\RediSearch\Redis\Client\PredisClient
            [1] => MacFJA\RediSearch\Redis\Client\CredisClient
            [2] => MacFJA\RediSearch\Redis\Client\PhpredisClient
            [3] => MacFJA\RediSearch\Redis\Client\PhpiredisClient
            [4] => MacFJA\RediSearch\Redis\Client\CheprasovRedisClient
            [5] => MacFJA\RediSearch\Redis\Client\RedisentClient
            [6] => MacFJA\RediSearch\Redis\Client\RediskaClient
            [7] => MacFJA\RediSearch\Redis\Client\AmpRedisClient
            [8] => MacFJA\RediSearch\Redis\Client\TinyRedisClient
        )

)

[2023-02-24 07:42:12] local.INFO:  (Object of MacFJA\RediSearch\IndexBuilder) : -1 $builder:: : Array
(
    [ MacFJA\RediSearch\IndexBuilder index] =>
    [ MacFJA\RediSearch\IndexBuilder structure] =>
    [ MacFJA\RediSearch\IndexBuilder prefixes] => Array
        (
        )

    [ MacFJA\RediSearch\IndexBuilder filter] =>
    [ MacFJA\RediSearch\IndexBuilder defaultLanguage] =>
    [ MacFJA\RediSearch\IndexBuilder languageField] =>
    [ MacFJA\RediSearch\IndexBuilder defaultScore] =>
    [ MacFJA\RediSearch\IndexBuilder scoreField] =>
    [ MacFJA\RediSearch\IndexBuilder payloadField] =>
    [ MacFJA\RediSearch\IndexBuilder maxTextFields] =>
    [ MacFJA\RediSearch\IndexBuilder temporary] =>
    [ MacFJA\RediSearch\IndexBuilder noOffsets] =>
    [ MacFJA\RediSearch\IndexBuilder noHighLight] =>
    [ MacFJA\RediSearch\IndexBuilder noFields] =>
    [ MacFJA\RediSearch\IndexBuilder noFrequencies] =>
    [ MacFJA\RediSearch\IndexBuilder skipInitialScan] =>
    [ MacFJA\RediSearch\IndexBuilder stopWords] =>
    [ MacFJA\RediSearch\IndexBuilder fields] => Array
        (
        )

)

Searching in next for salvation of this issue I found a hint that this could be raised as
redis doesn't have the RediSearch module loaded. How can I check it and fix it ?

also which parameters have I to use in line :

\Predis\Client(/* ... */)
Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions