Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
114 changes: 49 additions & 65 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion src/ManticoreSearch/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -695,8 +695,12 @@ private function processSuggestion(
$docMap->put($suggestWord, $suggestion['docs']);
}

// If the word already has an exact match (distance=0), it's a real word — never merge it.
// Merging "how"+"to" into "howto" just because CALL SUGGEST returns something is wrong.
$hasExactMatch = (bool)array_filter($suggestions, fn($s) => $s['distance'] === 0);

// Smart merge logic - try to merge with next word if conditions are met
$mergeResult = $this->tryMergeWithNext(
$mergeResult = $hasExactMatch ? null : $this->tryMergeWithNext(
$word,
$i,
$normalized,
Expand Down