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
09f4729c
Commit
09f4729c
authored
Sep 12, 2013
by
Ujvari Gergely
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Made 'limit' and 'created' facet singleton
Also bugfix: added missing username formatter
parent
7204450b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
4 deletions
+22
-4
streamsearch.coffee
h/js/streamsearch.coffee
+22
-4
No files found.
h/js/streamsearch.coffee
View file @
09f4729c
...
...
@@ -83,6 +83,8 @@ class SearchHelper
class
StreamSearch
rules
:
user
:
formatter
:
(
user
)
->
'acct:'
+
user
+
'@'
+
window
.
location
.
hostname
exact_match
:
true
case_sensitive
:
false
and_or
:
'or'
...
...
@@ -151,8 +153,6 @@ class StreamSearch
query
:
search_query
callbacks
:
search
:
(
query
,
searchCollection
)
=>
console
.
log
'search'
# Do not search when no facet is given
unless
searchCollection
.
models
.
length
>
0
return
...
...
@@ -171,10 +171,28 @@ class StreamSearch
'query'
:
query
facetMatches
:
(
callback
)
=>
return
callback
[
'text'
,
'tags'
,
'uri'
,
'quote'
,
'created'
,
'user'
,
'limit'
],
{
preserveOrder
:
true
}
basicList
=
[
'text'
,
'tags'
,
'uri'
,
'quote'
,
'user'
]
# Created and limit should be singleton.
add_limit
=
true
add_created
=
true
for
facet
in
@
search
.
searchQuery
.
facets
()
if
facet
.
hasOwnProperty
'limit'
then
add_limit
=
false
if
facet
.
hasOwnProperty
'created'
then
add_created
=
false
if
add_limit
and
add_created
then
list
=
[
'text'
,
'tags'
,
'uri'
,
'quote'
,
'created'
,
'user'
,
'limit'
]
else
if
add_limit
then
list
=
[
'text'
,
'tags'
,
'uri'
,
'quote'
,
'user'
,
'limit'
]
else
if
add_created
then
list
=
[
'text'
,
'tags'
,
'uri'
,
'quote'
,
'created'
,
'user'
]
else
list
=
[
'text'
,
'tags'
,
'uri'
,
'quote'
,
'user'
]
return
callback
list
,
{
preserveOrder
:
true
}
valueMatches
:
(
facet
,
searchTerm
,
callback
)
->
console
.
log
'valMatches'
console
.
log
facet
switch
facet
when
'limit'
then
callback
[
0
,
10
,
25
,
50
,
100
,
250
,
1000
]
when
'limit'
callback
[
'0'
,
'10'
,
'25'
,
'50'
,
'100'
,
'250'
,
'1000'
]
when
'created'
callback
[
'5 min'
,
'30 min'
,
'1 hour'
,
'12 hours'
,
'1 day'
,
'1 week'
,
'1 month'
,
'1 year'
],
{
preserveOrder
:
true
}
clearSearch
:
(
original
)
=>
...
...
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