Interface SearchResult


public interface SearchResult
SearchResult represents a search result of a JCR query, returned by Query and SimpleSearch.
  • Method Details

    • getTotalMatches

      long getTotalMatches()
      Returns the total number of matches or the total as far as it is known. This depends on the query, i.e. it might just retrieve the minimum necessary up to getStartIndex() + getHitsPerPage(). Check hasMore() to see if there are more matches.
      Returns:
      the total number of matches.
    • hasMore

      boolean hasMore()
      Returns whether there are more matches than given by getTotalMatches().
      Returns:
      whether there are more matches than given by getTotalMatches()
    • getStartIndex

      long getStartIndex()
      Returns:
      the start index. i.e. from where to start to display the hits.
    • getHitsPerPage

      long getHitsPerPage()
      Returns:
      the number of hits to display on a page (0 for all).
    • getHits

      List<Hit> getHits()
      Returns:
      a List of Hits to display on the result page.
    • getNodes

      Iterator<Node> getNodes()
      Returns:
      the same list as getHits() but directly with the underlying nodes
      Since:
      5.3
    • getResources

      Iterator<Resource> getResources()
      Returns:
      the same list as getHits() but returning Resource objects
      Since:
      5.6
    • getResultPages

      List<ResultPage> getResultPages()
      Returns:
      a List of ResultPagees to display the navigation through the result pages. It may not return all the pages in the result due to performance concerns. The actual result is dependent on implementation i.e. it may return X previous pages and X next pages.
    • getPreviousPage

      ResultPage getPreviousPage()
      Returns:
      the page, which contains the information about the previous page. Returns null if there is no previous page (i.e. the current page is the first page).
    • getNextPage

      ResultPage getNextPage()
      Returns:
      the page, which contains the information about the next page. Returns null if there is no next page (i.e. the current page is the last page).
    • getExecutionTime

      String getExecutionTime()
      Returns the execution time in fractions of a second.
      Example: 0.08 (means, the query took 80 milliseconds to execute).
      Returns:
      the execution time of the query.
    • getExecutionTimeMillis

      long getExecutionTimeMillis()
      Returns the execution time in milliseconds.
      Returns:
      the execution time of the query.
    • getFacets

      Map<String,Facet> getFacets() throws RepositoryException
      Returns the facets for this search result.
      Returns:
      the facets for this search result.
      Throws:
      RepositoryException - if an error occurs while executing the query or calculating the facets.
    • getQueryStatement

      String getQueryStatement()
      Returns the actual query string run against the repository, eg. an XPath statement. Please note that this does not describe the full query - for a simple list of the predicates that filter see getFilteringPredicates().
      Returns:
      a string of the query that was created
    • getFilteringPredicates

      String getFilteringPredicates()
      Returns a string with a list of the predicates that were filtering the result set (as opposed to using XPath, see getQueryStatement()). The returned string is for informational purposes only and might not fully describe the predicates and their parameters.
      Returns:
      a string mentioning all the predicates that filtered the result set