Permalink
Browse files

Search and ajax autocomplete for related entities are now case insens…

…itive
  • Loading branch information...
vrobic authored and javiereguiluz committed Apr 29, 2016
1 parent c864ca7 commit 94b8c76f78a2a43057bde46ae02a1e4988e62901
Showing with 4 additions and 2 deletions.
  1. +4 −2 Search/QueryBuilder.php
View
@@ -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);
}
}

0 comments on commit 94b8c76

Please sign in to comment.