Skip to content

Commit a908f5f

Browse files
authored
Merge pull request #30270 from nextcloud/search-folder-case-insensitive-21
2 parents 6ffe3ae + f6024a8 commit a908f5f

3 files changed

Lines changed: 6 additions & 3 deletions

File tree

lib/private/Files/Cache/QuerySearchHelper.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
class QuerySearchHelper {
4040
protected static $searchOperatorMap = [
4141
ISearchComparison::COMPARE_LIKE => 'iLike',
42+
ISearchComparison::COMPARE_LIKE_CASE_SENSITIVE => 'like',
4243
ISearchComparison::COMPARE_EQUAL => 'eq',
4344
ISearchComparison::COMPARE_GREATER_THAN => 'gt',
4445
ISearchComparison::COMPARE_GREATER_THAN_EQUAL => 'gte',
@@ -48,6 +49,7 @@ class QuerySearchHelper {
4849

4950
protected static $searchOperatorNegativeMap = [
5051
ISearchComparison::COMPARE_LIKE => 'notLike',
52+
ISearchComparison::COMPARE_LIKE_CASE_SENSITIVE => 'notLike',
5153
ISearchComparison::COMPARE_EQUAL => 'neq',
5254
ISearchComparison::COMPARE_GREATER_THAN => 'lte',
5355
ISearchComparison::COMPARE_GREATER_THAN_EQUAL => 'lt',
@@ -187,8 +189,8 @@ private function validateComparison(ISearchComparison $operator) {
187189
$comparisons = [
188190
'mimetype' => ['eq', 'like'],
189191
'mtime' => ['eq', 'gt', 'lt', 'gte', 'lte'],
190-
'name' => ['eq', 'like'],
191-
'path' => ['eq', 'like'],
192+
'name' => ['eq', 'like', 'clike'],
193+
'path' => ['eq', 'like', 'clike'],
192194
'size' => ['eq', 'gt', 'lt', 'gte', 'lte'],
193195
'tagname' => ['eq', 'like'],
194196
'favorite' => ['eq'],

lib/private/Files/Node/Folder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ public function search($query) {
263263
$subQueryLimit = $query->getLimit() > 0 ? $query->getLimit() + $query->getOffset() : 0;
264264
$rootQuery = new SearchQuery(
265265
new SearchBinaryOperator(ISearchBinaryOperator::OPERATOR_AND, [
266-
new SearchComparison(ISearchComparison::COMPARE_LIKE, 'path', $internalPath . '%'),
266+
new SearchComparison(ISearchComparison::COMPARE_LIKE_CASE_SENSITIVE, 'path', $internalPath . '%'),
267267
$query->getSearchOperation(),
268268
]
269269
),

lib/public/Files/Search/ISearchComparison.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ interface ISearchComparison extends ISearchOperator {
3434
public const COMPARE_LESS_THAN = 'lt';
3535
public const COMPARE_LESS_THAN_EQUAL = 'lte';
3636
public const COMPARE_LIKE = 'like';
37+
public const COMPARE_LIKE_CASE_SENSITIVE = 'clike';
3738

3839
/**
3940
* Get the type of comparison, one of the ISearchComparison::COMPARE_* constants

0 commit comments

Comments
 (0)