Commit 0b182df8 authored by Randall Leeds's avatar Randall Leeds

Rewrite search pagination to use regular search

Replace the use of the websocket for scrollback with a simple
pagination scheme.
parent 3d3eacfa
......@@ -13,6 +13,18 @@ module.exports = class StreamController
queryParser, searchFilter, store,
streamer, streamFilter, threading, annotationMapper
) ->
offset = 0
fetch = (limit) ->
options = {offset, limit}
searchParams = searchFilter.toObject($routeParams.q)
query = angular.extend(options, searchParams)
store.SearchResource.get(query, load)
load = ({rows}) ->
offset += rows.length
annotationMapper.loadAnnotations(rows)
# Disable the thread filter (client-side search)
$scope.$on '$routeChangeSuccess', ->
if $scope.threadFilter?
......@@ -39,11 +51,8 @@ module.exports = class StreamController
queryParser.populateFilter streamFilter, terms
streamer.send({filter: streamFilter.getFilter()})
# Perform the search
searchParams = searchFilter.toObject $routeParams.q
query = angular.extend limit: 20, searchParams
store.SearchResource.get query, ({rows}) ->
annotationMapper.loadAnnotations(rows)
# Perform the initial search
fetch(20)
$scope.isEmbedded = false
$scope.isStream = true
......@@ -52,5 +61,4 @@ module.exports = class StreamController
$scope.shouldShowThread = (container) -> true
$scope.loadMore = (number) ->
streamer.send({messageType: 'more_hits', moreHits: number})
$scope.loadMore = fetch
......@@ -2,7 +2,7 @@
<ul class="stream-list"
deep-count="count"
thread-filter="search.query"
window-scroll="loadMore(10)">
window-scroll="loadMore(20)">
<li ng-show="threadFilter.active()"
><span ng-pluralize
count="count('match')"
......
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