Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
jio
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
Guillaume Royer
jio
Commits
bd4765db
Commit
bd4765db
authored
Jul 10, 2015
by
Xiaowu Zhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
queries: add support for chinese character research
parent
777b1010
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
48 additions
and
1 deletion
+48
-1
src/queries/build/parser.js
src/queries/build/parser.js
+1
-1
test/queries/tests.js
test/queries/tests.js
+47
-0
No files found.
src/queries/build/parser.js
View file @
bd4765db
...
@@ -162,7 +162,7 @@ switch( state )
...
@@ -162,7 +162,7 @@ switch( state )
case
15
:
case
15
:
if
(
info
.
src
.
charCodeAt
(
pos
)
==
34
)
state
=
7
;
if
(
info
.
src
.
charCodeAt
(
pos
)
==
34
)
state
=
7
;
else
if
(
(
info
.
src
.
charCodeAt
(
pos
)
>=
0
&&
info
.
src
.
charCodeAt
(
pos
)
<=
33
)
||
(
info
.
src
.
charCodeAt
(
pos
)
>=
35
&&
info
.
src
.
charCodeAt
(
pos
)
<=
91
)
||
(
info
.
src
.
charCodeAt
(
pos
)
>=
93
&&
info
.
src
.
charCodeAt
(
pos
)
<=
254
)
)
state
=
15
;
else
if
(
(
info
.
src
.
charCodeAt
(
pos
)
>=
0
&&
info
.
src
.
charCodeAt
(
pos
)
<=
33
)
||
(
info
.
src
.
charCodeAt
(
pos
)
>=
35
&&
info
.
src
.
charCodeAt
(
pos
)
<=
91
)
||
(
info
.
src
.
charCodeAt
(
pos
)
>=
93
&&
info
.
src
.
charCodeAt
(
pos
)
<=
254
)
||
info
.
src
.
charCodeAt
(
pos
)
>
255
)
state
=
15
;
else
if
(
info
.
src
.
charCodeAt
(
pos
)
==
92
)
state
=
17
;
else
if
(
info
.
src
.
charCodeAt
(
pos
)
==
92
)
state
=
17
;
else
state
=
-
1
;
else
state
=
-
1
;
break
;
break
;
...
...
test/queries/tests.js
View file @
bd4765db
...
@@ -101,6 +101,53 @@
...
@@ -101,6 +101,53 @@
}).
always
(
start
);
}).
always
(
start
);
});
});
test
(
'
Chinese Character
'
,
function
()
{
var
doc_list
=
[
{
"
identifier
"
:
[
"
测试一
"
,
"
测试四
"
]},
{
"
identifier
"
:
[
"
测试一
"
,
"
测试五
"
]},
{
"
identifier
"
:
[
"
a
"
,
"
b
"
]}
];
stop
();
jIO
.
QueryFactory
.
create
(
'
(identifier: "%测试一%" OR identifier: "%测试二%") AND identifier: "%测试四%"
'
)
.
exec
(
doc_list
).
then
(
function
(
doc_list
)
{
deepEqual
(
doc_list
,
[
{
"
identifier
"
:
[
"
测试一
"
,
"
测试四
"
]}
],
'
Only first document should be kept
'
);
doc_list
=
[
{
"
identifier
"
:
[
"
测试一
"
,
"
测试四
"
]},
{
"
identifier
"
:
[
"
测试一
"
,
"
测试五
"
]},
{
"
identifier
"
:
[
"
测试四
"
,
"
b
"
]}
];
return
jIO
.
QueryFactory
.
create
(
'
identifier: "%测试%"
'
)
.
exec
(
doc_list
);
})
.
then
(
function
(
doc_list
)
{
deepEqual
(
doc_list
,
[
{
"
identifier
"
:
[
"
测试一
"
,
"
测试四
"
]},
{
"
identifier
"
:
[
"
测试一
"
,
"
测试五
"
]},
{
"
identifier
"
:
[
"
测试四
"
,
"
b
"
]}
],
'
All document should be kept
'
);
doc_list
=
[
{
"
identifier
"
:
"
测试一
"
},
{
"
identifier
"
:
"
测试一
"
,
"
title
"
:
"
标题
"
},
{
"
identifier
"
:
"
测试一
"
,
"
title
"
:
"
b
"
}
];
return
jIO
.
QueryFactory
.
create
(
'
identifier: "%测试%" AND title: "标题"
'
)
.
exec
(
doc_list
);
})
.
then
(
function
(
doc_list
)
{
deepEqual
(
doc_list
,
[
{
"
identifier
"
:
"
测试一
"
,
"
title
"
:
"
标题
"
}
],
'
Only second document should be kept
'
);
}).
always
(
start
);
});
test
(
'
Wildcard Character
'
,
function
()
{
test
(
'
Wildcard Character
'
,
function
()
{
var
doc_list
=
[
var
doc_list
=
[
{
"
identifier
"
:
"
a
"
},
{
"
identifier
"
:
"
a
"
},
...
...
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