Skip to content

Commit

Permalink
Search and ajax autocomplete for related entities are now case insens…
Browse files Browse the repository at this point in the history
…itive
  • Loading branch information
vrobic authored and javiereguiluz committed May 6, 2016
1 parent c864ca7 commit 94b8c76
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Search/QueryBuilder.php
Expand Up @@ -86,10 +86,12 @@ public function createSearchQueryBuilder(array $entityConfig, $searchQuery, $sor
// adding '0' turns the string into a numeric value
$queryParameters['exact_query'] = 0 + $searchQuery;
} elseif ($isTextField) {
$queryBuilder->orWhere(sprintf('entity.%s LIKE :fuzzy_query', $name));
$searchQuery = strtolower($searchQuery);

$queryBuilder->orWhere(sprintf('LOWER(entity.%s) LIKE :fuzzy_query', $name));
$queryParameters['fuzzy_query'] = '%'.$searchQuery.'%';

$queryBuilder->orWhere(sprintf('entity.%s IN (:words_query)', $name));
$queryBuilder->orWhere(sprintf('LOWER(entity.%s) IN (:words_query)', $name));
$queryParameters['words_query'] = explode(' ', $searchQuery);
}
}
Expand Down

0 comments on commit 94b8c76

Please sign in to comment.