Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
jio_mebibou
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Alexandra Rogova
jio_mebibou
Commits
a00c7056
Commit
a00c7056
authored
Sep 20, 2017
by
preetwinder
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change regex to case insensitive
parent
a14e25f4
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
2 deletions
+33
-2
src/queries/query.js
src/queries/query.js
+1
-1
test/queries/key.tests.js
test/queries/key.tests.js
+2
-1
test/queries/tests.js
test/queries/tests.js
+30
-0
No files found.
src/queries/query.js
View file @
a00c7056
...
@@ -416,7 +416,7 @@
...
@@ -416,7 +416,7 @@
}
}
return
new
RegExp
(
"
^
"
+
stringEscapeRegexpCharacters
(
string
)
return
new
RegExp
(
"
^
"
+
stringEscapeRegexpCharacters
(
string
)
.
replace
(
regexp_percent
,
'
[
\\
s
\\
S]*
'
)
.
replace
(
regexp_percent
,
'
[
\\
s
\\
S]*
'
)
.
replace
(
regexp_underscore
,
'
.
'
)
+
"
$
"
);
.
replace
(
regexp_underscore
,
'
.
'
)
+
"
$
"
,
"
i
"
);
}
}
/**
/**
...
...
test/queries/key.tests.js
View file @
a00c7056
...
@@ -601,7 +601,8 @@
...
@@ -601,7 +601,8 @@
then
(
function
(
dl
)
{
then
(
function
(
dl
)
{
deepEqual
(
dl
,
[
deepEqual
(
dl
,
[
{
'
identifier
'
:
'
àéîöùç
'
},
{
'
identifier
'
:
'
àéîöùç
'
},
{
'
identifier
'
:
'
âèî ôùc
'
}
{
'
identifier
'
:
'
âèî ôùc
'
},
{
'
identifier
'
:
'
ÀÉÎÖÙÇ
'
}
],
'
It should be possible to query regardless of accents
'
);
],
'
It should be possible to query regardless of accents
'
);
})
})
);
);
...
...
test/queries/tests.js
View file @
a00c7056
...
@@ -475,6 +475,36 @@
...
@@ -475,6 +475,36 @@
});
});
});
});
test
(
'
Case insensitive queries
'
,
function
()
{
var
doc_list
=
[
{
"
identifier
"
:
"
a
"
,
"
value
"
:
"
Test Post
"
,
"
time
"
:
"
2016
"
},
{
"
identifier
"
:
"
b
"
,
"
value
"
:
"
test post
"
,
"
time
"
:
"
2017
"
},
{
"
identifier
"
:
"
c
"
,
"
value
"
:
"
test3
"
,
"
time
"
:
"
2018
"
}
];
stop
();
expect
(
2
);
jIO
.
QueryFactory
.
create
(
'
test post
'
).
exec
(
doc_list
).
then
(
function
(
doc_list
)
{
deepEqual
(
doc_list
,
[
{
"
identifier
"
:
"
a
"
,
"
value
"
:
"
Test Post
"
,
"
time
"
:
"
2016
"
},
{
"
identifier
"
:
"
b
"
,
"
value
"
:
"
test post
"
,
"
time
"
:
"
2017
"
}
],
'
Documunts with the value irrespective of case are matched
'
);
doc_list
=
[
{
"
identifier
"
:
"
a
"
,
"
value
"
:
"
Test Post
"
,
"
time
"
:
"
2016
"
},
{
"
identifier
"
:
"
b
"
,
"
value
"
:
"
test post
"
,
"
time
"
:
"
2017
"
},
{
"
identifier
"
:
"
c
"
,
"
value
"
:
"
test3
"
,
"
time
"
:
"
2018
"
}
];
return
jIO
.
QueryFactory
.
create
(
'
value:"test post"
'
).
exec
(
doc_list
).
then
(
function
(
doc_list
)
{
deepEqual
(
doc_list
,
[
{
"
identifier
"
:
"
b
"
,
"
value
"
:
"
test post
"
,
"
time
"
:
"
2017
"
}
],
'
If value is in quotes, only match if exactly same
'
);
}).
always
(
start
);
});
});
// Asterisk wildcard is not supported yet.
// Asterisk wildcard is not supported yet.
/* test('Full text query with asterisk', function () {
/* test('Full text query with asterisk', function () {
var doc_list = [
var doc_list = [
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment