Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.RuntimeCollective.search.bean
Class SearchResults  view SearchResults download SearchResults.java

java.lang.Object
  extended bycom.RuntimeCollective.search.bean.SearchResults

public class SearchResults
extends java.lang.Object

A collection of SearchResult objects, with methods to access them conveniently from a jsp

Version:
$Id: SearchResults.java,v 1.12 2003/09/30 15:12:57 joe Exp $

Field Summary
(package private)  java.util.Vector allResults
           
(package private)  int page
           
(package private)  int resultsPerPage
           
(package private)  SearchCriterion[] searchCriteria
           
protected  com.RuntimeCollective.webapps.bean.User TheUser
           
 
Constructor Summary
SearchResults(org.apache.lucene.search.Hits hits, SearchCriterion[] sc)
          Make a new set of SearchResults, from a Lucene Hits collection.
SearchResults(org.apache.lucene.search.Hits hits, SearchCriterion[] sc, int maxNoResults)
          Make a new set of SearchResults, from a Lucene Hits collection, with a maximum size.
 
Method Summary
 java.util.List getAllResults()
          Return a List that contains all the SearchResult objects in this collection.
 java.lang.String getFirstCriterion()
          Return a string of the first search criteria given for this search.
 boolean getFirstFindAllWords()
          Return the value of the first search criteria's findAllWords.
 boolean getHasNextPage()
          Returns true if there is another search results page
 boolean getHasPreviousPage()
          Returns true if there is a previous search results page
 int getMaxPageNumber()
          Get the highest page number available
 int getNumberOfResults()
          Returns the number of search results
 int getPageNumber()
          Get which "page" of results will be returned by getPageResults()
 java.util.List getPageResults()
          Return a List that contains the next set of SearchResult objects in this collection.
 int getResultsPerPage()
          Get the number of results to return with getPageResults()
 SearchCriterion[] getSearchCriteriaObjects()
          Return an array of SearchCriteria.
 com.RuntimeCollective.webapps.bean.User getUser()
          Returns the User who performed this Search
 boolean nextPage()
          Advance one page; returns false if there is no next page
 boolean previousPage()
          Go back one page; returns false if there is no page before
 void removeResult(int pos)
          Remove one result
 void setAllResults(java.util.List results)
          Set the List that contains all the SearchResult objects in this collection.
 void setPageNumber(int page)
          Directly select which "page" of results to return with getPageResults().
 void setResultsPerPage(int resultsPerPage)
          Set the number of results to return with getPageResults()
 void setUser(com.RuntimeCollective.webapps.bean.User user)
          Set the User who performed this Search
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

allResults

java.util.Vector allResults

page

int page

resultsPerPage

int resultsPerPage

searchCriteria

SearchCriterion[] searchCriteria

TheUser

protected com.RuntimeCollective.webapps.bean.User TheUser
Constructor Detail

SearchResults

public SearchResults(org.apache.lucene.search.Hits hits,
                     SearchCriterion[] sc)
              throws com.RuntimeCollective.search.SearchException
Make a new set of SearchResults, from a Lucene Hits collection. This constructor is called from SearchIndex.performSearch().


SearchResults

public SearchResults(org.apache.lucene.search.Hits hits,
                     SearchCriterion[] sc,
                     int maxNoResults)
              throws com.RuntimeCollective.search.SearchException
Make a new set of SearchResults, from a Lucene Hits collection, with a maximum size. This constructor is called from SearchIndex.performSearch().

Method Detail

getSearchCriteriaObjects

public SearchCriterion[] getSearchCriteriaObjects()
Return an array of SearchCriteria.


getFirstCriterion

public java.lang.String getFirstCriterion()
Return a string of the first search criteria given for this search. (maybe there'll be different ways of doing this when we eventually have multiple criteria...)


getFirstFindAllWords

public boolean getFirstFindAllWords()
Return the value of the first search criteria's findAllWords. (maybe there'll be different ways of doing this when we eventually have multiple criteria...)


setUser

public void setUser(com.RuntimeCollective.webapps.bean.User user)
Set the User who performed this Search


getUser

public com.RuntimeCollective.webapps.bean.User getUser()
Returns the User who performed this Search


getNumberOfResults

public int getNumberOfResults()
Returns the number of search results


getAllResults

public java.util.List getAllResults()
Return a List that contains all the SearchResult objects in this collection.


setAllResults

public void setAllResults(java.util.List results)
Set the List that contains all the SearchResult objects in this collection.


removeResult

public void removeResult(int pos)
Remove one result


getPageResults

public java.util.List getPageResults()
Return a List that contains the next set of SearchResult objects in this collection.

How many SearchResults are in the List depends on resultsPerPage, which is set with setResultsPerPage.

To advance to the next page of results, call nextPage().

To set the next page arbitrarily, call setPageNumber(int).


getHasNextPage

public boolean getHasNextPage()
Returns true if there is another search results page


getHasPreviousPage

public boolean getHasPreviousPage()
Returns true if there is a previous search results page


nextPage

public boolean nextPage()
Advance one page; returns false if there is no next page


previousPage

public boolean previousPage()
Go back one page; returns false if there is no page before


getMaxPageNumber

public int getMaxPageNumber()
Get the highest page number available


getResultsPerPage

public int getResultsPerPage()
Get the number of results to return with getPageResults()


setResultsPerPage

public void setResultsPerPage(int resultsPerPage)
Set the number of results to return with getPageResults()


getPageNumber

public int getPageNumber()
Get which "page" of results will be returned by getPageResults()


setPageNumber

public void setPageNumber(int page)
Directly select which "page" of results to return with getPageResults().