 # Helper functions
 ################################
 
-    $scope.findFacet = (typeName, res) ->
+    findFacet = (typeName, res) ->
       if res != null and res.facets.content_type
          facets = (facet.val for facet in res.facets.content_type.buckets)
          return facets.indexOf(typeName)
       else
          return -1
 
-    $scope.getTypeCounts = (type, res) ->
-      idx = $scope.findFacet(type, res)
+    getTypeCounts = (type, res) ->
+      idx = findFacet(type, res)
       console.log(idx)
       if idx < 0
         return null
       return res?.facets?.content_type?.buckets[idx].count ? 0
 
-    $scope.findResult = (typeName, res) ->
+    findResult = (typeName, res) ->
       console.log("RESULT IS", res)
       if res != null
         groups = (group.groupValue for group in res.grouped.content_type.groups)

      $scope.originalQuery = params.query
    console.log(results)
    $scope.offset = parseInt($location.search().offset, 10) || 0
    $scope.parseResults(results)

    console.log(results)


      console.log($scope.selectedType, $scope.selectedType.join(" "))
      if $scope.selectedType.join(" ").includes($scope.volumeDisplayStr)
        $scope.query = $scope.originalQuery
        search()
      if $scope.selectedType.join(" ").includes($scope.partyDisplayStr)
        $scope.query = $scope.originalQuery
        search()
      console.log($scope.selectedType, $scope.filterDisplay)

    # Action to do something when a filter option is clicked
