sulu / SuluHeadlessBundle

Bundle that provides controllers and services for using Sulu as headless content management system
MIT License
47 stars 25 forks source link

SearchController does not work for wildcard and fuzzy keywords #36

Closed ahoek closed 4 years ago

ahoek commented 4 years ago

The query string that is created puts quotes around the wildcard and fuzzy keywords, so only the exact keyword matches are found.

                $queryString .= '+("' . self::escapeDoubleQuotes($queryValue) . '" OR ' .
                    '"' . preg_replace('/([^\pL\s\d])/u', '?', $queryValue) . '*" OR ' .
                    '"' . preg_replace('/([^\pL\s\d])/u', '', $queryValue) . '~") ';

When I remove these quotes, the search works as expected.

                $queryString .= '+("' . self::escapeDoubleQuotes($queryValue) . '" OR ' .
                    '' . preg_replace('/([^\pL\s\d])/u', '?', $queryValue) . '* OR ' .
                    '' . preg_replace('/([^\pL\s\d])/u', '', $queryValue) . '~) ';
alexander-schranz commented 4 years ago

fixed by #37