Make search attributes not case sensitive
This commit is contained in:
parent
48ee733f9e
commit
9496dfdb6d
|
|
@ -9,6 +9,7 @@ New features:
|
|||
|
||||
Improvements:
|
||||
|
||||
* Make search attributes not case sensitive
|
||||
* Display TOTP issuer for 2FA
|
||||
* Make sure that the table schema_version use InnoDB for Mysql
|
||||
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ class LexerBuilder
|
|||
|
||||
foreach ($attributes as $attribute) {
|
||||
$this->filters[$attribute] = $filter;
|
||||
$this->lexer->addToken(sprintf("/^(%s:)/", $attribute), $attribute);
|
||||
$this->lexer->addToken(sprintf("/^(%s:)/i", $attribute), $attribute);
|
||||
|
||||
if ($default) {
|
||||
$this->lexer->setDefaultToken($attribute);
|
||||
|
|
|
|||
|
|
@ -103,4 +103,24 @@ class LexerBuilderTest extends Base
|
|||
$this->assertFalse($builder === $clone);
|
||||
$this->assertFalse($builder->build('test')->getQuery() === $clone->build('test')->getQuery());
|
||||
}
|
||||
|
||||
public function testBuilderWithMixedCaseSearchAttribute()
|
||||
{
|
||||
$project = new ProjectModel($this->container);
|
||||
$taskCreation = new TaskCreationModel($this->container);
|
||||
$taskFinder = new TaskFinderModel($this->container);
|
||||
$query = $taskFinder->getExtendedQuery();
|
||||
|
||||
$this->assertEquals(1, $project->create(array('name' => 'Project')));
|
||||
$this->assertNotFalse($taskCreation->create(array('project_id' => 1, 'title' => 'Test')));
|
||||
|
||||
$builder = new LexerBuilder();
|
||||
$builder->withFilter(new TaskAssigneeFilter());
|
||||
$builder->withFilter(new TaskTitleFilter(), true);
|
||||
$builder->withQuery($query);
|
||||
$tasks = $builder->build('AsSignEe:nobody')->toArray();
|
||||
|
||||
$this->assertCount(1, $tasks);
|
||||
$this->assertEquals('Test', $tasks[0]['title']);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue