Commit ff1c8bd1 authored by Nick Stenning's avatar Nick Stenning

Merge pull request #2882 from hypothesis/stream-group-hashid-query

Recognize 'group' as a valid parameter name in search queries
parents 1c32ec60 4db67d41
...@@ -12,7 +12,8 @@ module.exports = class SearchFilter ...@@ -12,7 +12,8 @@ module.exports = class SearchFilter
# The whole term is data # The whole term is data
return [null, term] return [null, term]
if filter in ['quote', 'result', 'since', 'tag', 'text', 'uri', 'user'] if filter in ['group', 'quote', 'result', 'since',
'tag', 'text', 'uri', 'user']
data = term[filter.length+1..] data = term[filter.length+1..]
return [filter, data] return [filter, data]
else else
......
...@@ -26,12 +26,13 @@ describe 'searchFilter', -> ...@@ -26,12 +26,13 @@ describe 'searchFilter', ->
assert.equal(result.any[0], query) assert.equal(result.any[0], query)
it 'uses the filters as keys in the result object', -> it 'uses the filters as keys in the result object', ->
query = 'user:john text:foo quote:bar other' query = 'user:john text:foo quote:bar group:agroup other'
result = searchFilter.toObject(query) result = searchFilter.toObject(query)
assert.equal(result.any[0], 'other') assert.equal(result.any[0], 'other')
assert.equal(result.user[0], 'john') assert.equal(result.user[0], 'john')
assert.equal(result.text[0], 'foo') assert.equal(result.text[0], 'foo')
assert.equal(result.quote[0], 'bar') assert.equal(result.quote[0], 'bar')
assert.equal(result.group[0], 'agroup')
it 'collects the same filters into a list', -> it 'collects the same filters into a list', ->
query = 'user:john text:foo quote:bar other user:doe text:fuu text:fii' query = 'user:john text:foo quote:bar other user:doe text:fuu text:fii'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment