Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
coopwire-hypothesis
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
孙灵跃 Leon Sun
coopwire-hypothesis
Commits
0b6f675c
Commit
0b6f675c
authored
Nov 13, 2014
by
Gergely Ujvari
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Do not normalize searchfilter sent to the backend.
We have every analyzers setup for ES to do that more precisely.
parent
6eef7b3d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
14 deletions
+14
-14
searchfilters.coffee
h/static/scripts/searchfilters.coffee
+6
-14
services.coffee
h/static/scripts/services.coffee
+8
-0
No files found.
h/static/scripts/searchfilters.coffee
View file @
0b6f675c
...
...
@@ -43,14 +43,6 @@ class SearchFilter
tokens
# Converts a string into lowercase and asciifolds
this
.
$inject
=
[
'stringHelpers'
]
constructor
:
(
stringHelpers
)
->
@
_normalize
=
(
str
)
->
if
typeof
str
is
'string'
return
stringHelpers
.
unidecode
(
str
.
toLowerCase
())
else
return
str
# This function will generate the facets from the search-text input
# It'll first tokenize it and then sorts them into facet lists
# The output will be a dict with the following structure:
...
...
@@ -82,7 +74,7 @@ class SearchFilter
filter
=
term
.
slice
0
,
term
.
indexOf
":"
unless
filter
?
then
filter
=
""
switch
filter
when
'quote'
then
quote
.
push
@
_normalize
term
[
6
..]
when
'quote'
then
quote
.
push
term
[
6
..]
when
'result'
then
result
.
push
term
[
7
..]
when
'since'
# We'll turn this into seconds
...
...
@@ -118,11 +110,11 @@ class SearchFilter
# Time given in year
t
=
/^(\d+)year$/
.
exec
(
time
)[
1
]
since
.
push
t
*
60
*
60
*
24
*
365
when
'tag'
then
tag
.
push
@
_normalize
term
[
4
..]
when
'text'
then
text
.
push
@
_normalize
term
[
5
..]
when
'uri'
then
uri
.
push
@
_normalize
term
[
4
..]
when
'user'
then
user
.
push
@
_normalize
term
[
5
..]
else
any
.
push
@
_normalize
term
when
'tag'
then
tag
.
push
term
[
4
..]
when
'text'
then
text
.
push
term
[
5
..]
when
'uri'
then
uri
.
push
term
[
4
..]
when
'user'
then
user
.
push
term
[
5
..]
else
any
.
push
term
any
:
terms
:
any
...
...
h/static/scripts/services.coffee
View file @
0b6f675c
...
...
@@ -507,6 +507,14 @@ class ViewFilter
limit
=
Math
.
min
((
filters
.
result
?
.
terms
or
[])...)
count
=
0
# Normalizing the filters, need to do only once.
for
_
,
filter
of
filters
if
filter
.
terms
filter
.
terms
=
filter
.
terms
.
map
(
e
)
=>
e
=
e
.
toLowerCase
()
e
=
@
_normalize
e
e
for
annotation
in
annotations
break
if
count
>=
limit
...
...
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