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

Unable to search substring inside a string #271

Open
gopibabus opened this issue Jul 1, 2022 · 6 comments
Open

Unable to search substring inside a string #271

gopibabus opened this issue Jul 1, 2022 · 6 comments

Comments

@gopibabus
Copy link

gopibabus commented Jul 1, 2022

Unable to search substring. I can only search exact string. How can I search for substring inside a string. I am adding my config. Please guide me to search substring @nticaric

//SearchEngine::config()
[
            'driver'    => getenv('SEARCH_INDEX_DB_DRIVER'),
            'host'      => getenv('DATABASE_HOSTNAME'),
            'database'  => getenv('DATABASE_NAME'),
            'username'  => getenv('DATABASE_USERNAME'),
            'password'  => getenv('DATABASE_PASSWORD'),
            'storage'   => getenv('SEARCH_INDEX_STORAGE_PATH'),
            'stemmer'   => NoStemmer::class,
            'tokenizer' => EdgeNgramTokenizer::class,
            'fuzziness' => true,
            'fuzzy'     => [
                'prefix_length'  => 10,
                'max_expansions' => 100,
                'distance'       => 10,
            ],
        ]
$tnt = new TNTSearch();
        $tnt->loadConfig(SearchEngine::config());

        $schema = 'public';

        foreach ($tablesToBeIndexed as $table) {
            $this->getCLI()->border()->info("Started indexing {$table} Table....");
            $indexer   = $tnt->createIndex("{$table}.index");
            $tableName = "{$schema}.{$table}";
            $indexer->query($this->getTableSelectionQuery($tableName));
            $indexer->includePrimaryKey();
            $indexer->run();
            $this->getCLI()->info("Completed indexing {$table} Table");
        }
$this->searchIndex = new TNTSearch();
$this->searchIndex->loadConfig(SearchEngine::config());
$this->searchIndex->selectIndex("{$table}.index");
$response = $this->searchIndex->searchBoolean($searchString);
 return $response['ids'];

I can search for entire string eSupport, but I am not able to search for support

Please guide me in the right direction or point me to the documentation

@gopibabus gopibabus changed the title Unable to search substring inside a string. Unable to search substring inside a string Jul 1, 2022
@gopibabus
Copy link
Author

@stokic Can you guide me in the right direction?

@somegooser
Copy link

looks like this project is abondent

@somegooser
Copy link

is there a alternative for this project or a lookalike? i really like the full text search engine

@nticaric
Copy link
Contributor

Fulltext search doesn't support substring search. In order to achieve such functionality you can try n-grams.

@gopibabus
Copy link
Author

gopibabus commented Jul 13, 2022

you can try n-grams.

Will try and post my observation. Thanks @nticaric

@somegooser
Copy link

Any updates on working with n-grams? Did you achieve searching with part of words?

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

No branches or pull requests

3 participants