Commit 4db67d41 authored by Robert Knight's avatar Robert Knight

Recognize 'group' as a valid parameter name in search queries

The backend already supports searches for 'group:hashid' but
this was not supported on the stream because 'group'
was not recognized as a valid parameter so it was passed
to the backend in the 'any' field.
parent a815f658
...@@ -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