       $scope.query = $scope.originalQuery
       $scope.offset = 0
       console.log("NEW SEARCH:", $scope.query)
-      search()
+      $scope.search()
 
     # Def search: the function that is actually calling the search from Haskell.
     # Get the results from Solr and pass them into parseResults.

        filterParties($scope.selectedFilter)
        console.log("FILTERING BY PARTY")
      $scope.offset = 0 # Reset the offset
      search()

    addArgToQuery = (query, arg, val) ->
      return query + "|arg=" + arg + ":\"" + val + "\""


      $scope.goToPage = (page) ->
        $scope.offset = $scope.limit * (page-1)
        $scope.search()

      if parseInt($scope.maxResults()) > ($scope.offset + $scope.limit)
        $scope.next = ->
          $scope.offset = $scope.offset + $scope.limit
          $scope.search()
      else
        $scope.next = undefined
      if $scope.offset > 0
        $scope.prev = ->
          $scope.offset = Math.max(0, $scope.offset - $scope.limit)
          $scope.search()
      else
        $scope.prev = undefined

