org.opensolaris.opengrok.search
Class SearchEngine

java.lang.Object
  extended by org.opensolaris.opengrok.search.SearchEngine

public class SearchEngine
extends java.lang.Object

This is an encapsulation of the details on how to seach in the index database.


Field Summary
static org.apache.lucene.util.Version LUCENE_VERSION
          version of lucene index common for whole app
 
Constructor Summary
SearchEngine()
          Creates a new instance of SearchEngine
 
Method Summary
 java.lang.String getDefinition()
          Getter for property definition.
 java.lang.String getFile()
          Getter for property file.
 java.lang.String getFreetext()
          Getter for property freetext.
 java.lang.String getHistory()
          Getter for property history.
 java.lang.String getQuery()
           
 java.lang.String getSymbol()
          Getter for property symbol.
 boolean isValidQuery()
           
 void results(int start, int end, java.util.List<Hit> ret)
          get results , if no search was started before, no results are returned this method will requery if end end is more than first query from search, hence performance hit applies, if you want results in later pages than number of cachePages also end has to be bigger than start !
 int search()
          Execute a search.
 void setDefinition(java.lang.String definition)
          Setter for property definition.
 void setFile(java.lang.String file)
          Setter for property file.
 void setFreetext(java.lang.String freetext)
          Setter for property freetext.
 void setHistory(java.lang.String history)
          Setter for property history.
 void setSymbol(java.lang.String symbol)
          Setter for property symbol.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LUCENE_VERSION

public static final org.apache.lucene.util.Version LUCENE_VERSION
version of lucene index common for whole app

Constructor Detail

SearchEngine

public SearchEngine()
Creates a new instance of SearchEngine

Method Detail

isValidQuery

public boolean isValidQuery()

getQuery

public java.lang.String getQuery()

search

public int search()
Execute a search. Before calling this function, you must set the appropriate seach critera with the set-functions. Note that this search will return the first cachePages of hitsPerPage, for more you need to call more

Returns:
The number of hits

results

public void results(int start,
                    int end,
                    java.util.List<Hit> ret)
get results , if no search was started before, no results are returned this method will requery if end end is more than first query from search, hence performance hit applies, if you want results in later pages than number of cachePages also end has to be bigger than start !

Parameters:
start - start of the hit list
end - end of the hit list
ret - list of results from start to end or null/empty if no search was started

getDefinition

public java.lang.String getDefinition()
Getter for property definition.

Returns:
Value of property definition.

setDefinition

public void setDefinition(java.lang.String definition)
Setter for property definition.

Parameters:
definition - New value of property definition.

getFile

public java.lang.String getFile()
Getter for property file.

Returns:
Value of property file.

setFile

public void setFile(java.lang.String file)
Setter for property file.

Parameters:
file - New value of property file.

getFreetext

public java.lang.String getFreetext()
Getter for property freetext.

Returns:
Value of property freetext.

setFreetext

public void setFreetext(java.lang.String freetext)
Setter for property freetext.

Parameters:
freetext - New value of property freetext.

getHistory

public java.lang.String getHistory()
Getter for property history.

Returns:
Value of property history.

setHistory

public void setHistory(java.lang.String history)
Setter for property history.

Parameters:
history - New value of property history.

getSymbol

public java.lang.String getSymbol()
Getter for property symbol.

Returns:
Value of property symbol.

setSymbol

public void setSymbol(java.lang.String symbol)
Setter for property symbol.

Parameters:
symbol - New value of property symbol.