Skip to content

Commit bc5d023

Browse files
committed
Add minimum requirement check for word matching and ignore empty phrases
1 parent 785b669 commit bc5d023

File tree

3 files changed

+30
-0
lines changed

3 files changed

+30
-0
lines changed

CHANGELOG-0.x.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
11
# CHANGELOG for 0.x
22
This changelog references the relevant changes done in 0.x versions.
33

4+
5+
## v0.3.2
6+
* BUG :: Add minimum requirement check for word matching `[a-zA-Z0-9]+` and ignore empty phrases.
7+
8+
49
## v0.3.1
510
* BUG :: Fix invalid string casting on Numbr in ElasticaQueryBuilder.
611

12+
713
## v0.3.0
814
__BREAKING CHANGES__
915

src/Tokenizer.php

407 Bytes
Binary file not shown.

tests/Fixtures/test-queries.php

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1756,6 +1756,30 @@
17561756
new Word('token'),
17571757
],
17581758
],
1759+
1760+
[
1761+
'name' => 'should not have words or phrases without real characters',
1762+
'input' => 'test taco-spice chester:copperpot :: : ; ;; " " , - -- - ++ "a phrase:" _ [ ] { } | \\ / ` * ~ ! @ ( ) # $ % ^ & = < > ?',
1763+
'expected_tokens' => [
1764+
[T::T_WORD, 'test'],
1765+
[T::T_WORD, 'taco-spice'],
1766+
[T::T_FIELD_START, 'chester'],
1767+
[T::T_WORD, 'copperpot'],
1768+
T::T_FIELD_END,
1769+
T::T_PROHIBITED,
1770+
T::T_REQUIRED,
1771+
[T::T_PHRASE, 'a phrase:'],
1772+
T::T_WILDCARD,
1773+
T::T_SUBQUERY_START,
1774+
T::T_SUBQUERY_END,
1775+
],
1776+
'expected_nodes' => [
1777+
new Word('test'),
1778+
new Word('taco-spice'),
1779+
new Field('chester', new Word('copperpot')),
1780+
new Phrase('a phrase:'),
1781+
],
1782+
],
17591783
/*
17601784
* END: WEIRD QUERIES
17611785
*/

0 commit comments

Comments
 (0)