|
Terrier IR Platform 2.2.1 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface SearchRequest
SearchRequest is the one of two main classes of which are made available to client code by the Terrier framework at retrieval time. Each search query, whether entered by a user or in batch mode retrieval creates a search request. Each search request is then passed to 4 methods of the Manager that is handling each search request: runPreProcessing, runMatching, runPostProcess and runPostFilters Example usage:
Index index = new Index() Manager manager = new Manager(index); SearchRequest srq = manager.newSearchRequest(); //parse the query TerrierLexer lexer = new TerrierLexer(new StringReader(query)); TerrierFloatLexer flexer = new TerrierFloatLexer(lexer.getInputState()); TokenStreamSelector selector = new TokenStreamSelector(); selector.addInputStream(lexer, "main"); selector.addInputStream(flexer, "numbers"); selector.select("main"); TerrierQueryParser parser = new TerrierQueryParser(selector); parser.setSelector(selector); srq.setQuery(parser.query()); srq.setQuery(query); //run the query m.runPreProcessing(srq); manager.runMatching(srq); manager.runPostProcess(srq); manager.runPostFilters(srq);
NB:Controls (name, value tuples ) are used to control the retrieval prcoess. You may want to set controls in your application code. However, default controls can be set using the querying.default.controls property in the terrier.properties file.
Method Summary | |
---|---|
void |
addMatchingModel(java.lang.String MatchingModelName,
java.lang.String WeightingModelName)
Set the matching model and weighting model that the Manager should use for this query. |
java.lang.String |
getControl(java.lang.String Name)
Returns the value of the control. |
int |
getNumberOfDocumentsAfterFiltering()
gets the number of documents returned for a search request, after applying post filtering |
java.lang.String |
getOriginalQuery()
gets the original query, before any preprocessing |
Query |
getQuery()
Get the Query syntax tree |
java.lang.String |
getQueryID()
Returns the query id as set by setQueryID(String). |
ResultSet |
getResultSet()
Returns the resultset generated by the query. |
long |
getStartedProcessingTime()
|
boolean |
isEmpty()
Set if the query input had no terms. |
void |
setControl(java.lang.String Name,
java.lang.String Value)
Set a control named to have value Value. |
void |
setNumberOfDocumentsAfterFiltering(int n)
Sets the number of documents returned for a search request, after applying post filtering |
void |
setOriginalQuery(java.lang.String q)
sets the original query, before any preprocessing |
void |
setQuery(Query q)
Set the query to be a parsed Query syntax tree, as generated by the Terrier query parser |
void |
setQueryID(java.lang.String qid)
Set a unique identifier for this query request. |
void |
setStartedProcessingTime(long time)
|
Method Detail |
---|
void addMatchingModel(java.lang.String MatchingModelName, java.lang.String WeightingModelName)
MatchingModelName
- the String class name that should be usedWeightingModelName
- the String class name that should be usedvoid setQuery(Query q)
q
- The Query object syntax treevoid setQueryID(java.lang.String qid)
qid
- the unique string identifierQuery getQuery()
void setControl(java.lang.String Name, java.lang.String Value)
Name
- the name of the control to set the value of.Value
- the value that the control should take.java.lang.String getQueryID()
ResultSet getResultSet()
java.lang.String getControl(java.lang.String Name)
boolean isEmpty()
void setOriginalQuery(java.lang.String q)
java.lang.String getOriginalQuery()
void setNumberOfDocumentsAfterFiltering(int n)
n
- int getNumberOfDocumentsAfterFiltering()
long getStartedProcessingTime()
void setStartedProcessingTime(long time)
|
Terrier IR Platform 2.2.1 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |