net.sf.zekr.engine.search
Class SearchResultModel

java.lang.Object
  extended by net.sf.zekr.engine.search.SearchResultModel
Direct Known Subclasses:
AdvancedSearchResult, SearchResult

public class SearchResultModel
extends java.lang.Object

Instances of this class hold search results. This class supports iteration.

Author:
Mohsen Saboorian

Nested Class Summary
 class SearchResultModel.Iter
           
 
Field Summary
protected  java.lang.String clause
           
protected  int maxResultPerPage
           
protected  int pageNum
          Current search page.
protected  java.lang.String rawQuery
           
protected  int resultPerPage
           
protected  java.util.List results
          A list of matched SearchResultItems.
protected  int totalMatch
           
 
Constructor Summary
SearchResultModel(IQuranText quranText, java.util.List results, java.lang.String clause, java.lang.String rawQuery, int totalMatch, AbstractSearchResultComparator ayaComparator, boolean ascending)
          Create an instance of this class to hold search results.
 
Method Summary
 java.lang.String getClause()
           
 int getMaxResultPerPage()
           
 java.util.List getPage(int page)
          Retrieves the specified page of search results.
 IQuranText getQuranText()
           
 java.lang.String getRawQuery()
           
 int getResultCount()
           
 int getResultPageCount()
           
 java.util.List getResults()
           
 int getTotalMatch()
           
 java.util.Iterator iterator()
          Create and return a new iterator to iterate on pages of SearchResultItems.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

resultPerPage

protected int resultPerPage

totalMatch

protected int totalMatch

rawQuery

protected java.lang.String rawQuery

clause

protected java.lang.String clause

maxResultPerPage

protected int maxResultPerPage

results

protected java.util.List results
A list of matched SearchResultItems.


pageNum

protected int pageNum
Current search page.

Constructor Detail

SearchResultModel

public SearchResultModel(IQuranText quranText,
                         java.util.List results,
                         java.lang.String clause,
                         java.lang.String rawQuery,
                         int totalMatch,
                         AbstractSearchResultComparator ayaComparator,
                         boolean ascending)
Create an instance of this class to hold search results.

Parameters:
quranText - Quran or translation text on which search taken place
results - a list of SearchResultItems
clause - a string representation of whole-words of all the matched text parts
rawQuery - raw user query
totalMatch - total count of all highlighted text parts
ayaComparator - the AbstractSearchResultComparator to be used for sorting results
ascending -
Method Detail

getPage

public java.util.List getPage(int page)
Retrieves the specified page of search results.

Parameters:
page - page number (zero-based)
Returns:
requested page
Throws:
java.util.NoSuchElementException - if no such page exists

getResults

public java.util.List getResults()

getResultCount

public int getResultCount()

getResultPageCount

public int getResultPageCount()

getTotalMatch

public int getTotalMatch()

getQuranText

public IQuranText getQuranText()

iterator

public java.util.Iterator iterator()
Create and return a new iterator to iterate on pages of SearchResultItems.

Returns:

getRawQuery

public java.lang.String getRawQuery()

getClause

public java.lang.String getClause()

getMaxResultPerPage

public int getMaxResultPerPage()