manticoresoftware / manticoresoftware/manticoresearch-php

How to get a modified query when searching with FUZZY

Open
#239 1 comment 0 reactions 1 assignee View on GitHub

@Nick-S-2018 is already working on this.

Since Feb 20, 2025.

Dominant language
PHP
Stars
211
Forks
39
Avg merge
1d 20h
Merged PRs (30d)
1

Description

Hello. Can you tell me if there is a way to get the actual query that was searched?
When the search is enabled with the fix
```php
$query = 'fzzy serch';
$result = $index->search($query)->option('fuzzy', 1)->get();
```
you can use the `highlight()` method to highlight the searched matches. But I'm integrating Manticore search into another CMS with built-in processing of search results based on content type and content ID, and highlighting is done based on the search query. That is, I'm pulling only two fields (type, id) from Manticore search results. I would like to get a fixed search query, for further rendering on the CMS side. When I used `$index->suggest($keyword['tokenized'], []);` without any difficulties it was possible to get the corrected words, collect them into a query string and render the highlighting based on the corrected search query on the CMS side.
With the new correction function, everything goes behind the scenes as I understand. I will be grateful for any help.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.