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
d2202e89
Commit
d2202e89
authored
Jan 19, 2015
by
gergely-ujvari
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1862 from hypothesis/1796-add-any-field-handling-for-search-API
1796 add any field handling for search api
parents
bd0b5822
766c8bc7
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
1 deletion
+22
-1
searchfilters.coffee
h/static/scripts/searchfilters.coffee
+20
-0
streamsearch.coffee
h/static/scripts/streamsearch.coffee
+2
-1
No files found.
h/static/scripts/searchfilters.coffee
View file @
d2202e89
...
...
@@ -43,6 +43,26 @@ class SearchFilter
tokens
# Turns string query into object, where the properties are the search terms
toObject
:
(
searchtext
)
->
obj
=
{}
addToObj
=
(
key
,
data
)
->
if
obj
[
key
]
?
obj
[
key
].
push
data
else
obj
[
key
]
=
[
data
]
if
searchtext
terms
=
@
_tokenize
(
searchtext
)
for
term
in
terms
[
filter
,
data
]
=
term
.
split
(
':'
)
unless
data
filter
=
'any'
data
=
term
addToObj
(
filter
,
data
)
obj
# 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:
...
...
h/static/scripts/streamsearch.coffee
View file @
d2202e89
...
...
@@ -20,7 +20,8 @@ class StreamSearchController
queryparser
.
populateFilter
streamfilter
,
terms
# Perform the search
query
=
angular
.
extend
limit
:
10
,
$scope
.
search
.
query
searchParams
=
searchfilter
.
toObject
$scope
.
search
.
query
query
=
angular
.
extend
limit
:
10
,
searchParams
store
.
SearchResource
.
get
query
,
({
rows
})
->
annotator
.
loadAnnotations
(
rows
)
...
...
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