|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectno.sesat.search.mode.command.AbstractSearchCommand
public abstract class AbstractSearchCommand
The base abstraction for Search Commands providing a large framework for commands to run against.
While the SearchCommand interface defines basic execution behavour this abstraction defines:
http://sesat.no/new-design-proposal-for-searchcommand-and-abstractsearchcommand.html
| Nested Class Summary | |
|---|---|
protected static class |
AbstractSearchCommand.QueryBuilderFactory
|
protected static class |
AbstractSearchCommand.ReconstructedQuery
see createQuery(string) |
| Nested classes/interfaces inherited from interface no.sesat.search.mode.command.SearchCommand |
|---|
SearchCommand.Context |
| Field Summary | |
|---|---|
protected boolean |
completed
|
protected SearchCommand.Context |
context
The context to work against. |
protected DataModel |
datamodel
|
protected Map<String,StringDataObject> |
datamodelParameters
|
protected static Logger |
DUMP
|
protected String |
untransformedQuery
|
| Constructor Summary | |
|---|---|
AbstractSearchCommand(SearchCommand.Context cxt)
Default constructor. |
|
| Method Summary | |
|---|---|
protected void |
addFilterString(String filter)
Makes presumption that filter is in format "field:value". |
ResultList<ResultItem> |
call()
Called by thread executor |
protected QueryBuilder |
constructQueryBuilder(SearchCommand.Context cxt,
QueryBuilder.Context queryBuilderContext)
Construct from scratch, and return the query builder to use. |
protected AbstractSearchCommand.ReconstructedQuery |
createQuery(String queryString)
Uses QueryParser to create a new Query with all evaluation enabled. |
protected AbstractSearchCommand.ReconstructedQuery |
createQuery(String queryString,
boolean evaluationEnabled)
Uses QueryParser to create a new Query with the option to disable evaluation. |
protected String |
escape(String word)
Escape the word (whether it requires escaping or not). |
abstract ResultList<ResultItem> |
execute()
|
protected int |
getCurrentOffset(int i)
Deprecated. instead use getOffset() + i |
protected TokenEvaluationEngine |
getEngine()
Use this always instead of context.getTokenEvaluationEngine() because the command could be running off a different query string. |
protected String |
getFieldFilter(LeafClause clause)
Returns null when no field exists. |
protected String |
getFilter()
|
protected FilterBuilder |
getFilterBuilder()
|
protected int |
getOffset()
Returns the offset applicable to this command. |
protected String |
getParameter(String paramName)
Returns parameter value. |
Query |
getQuery()
Use this always instead of datamodel.getQuery().getQuery() because the command could be running off a different query string. |
protected QueryBuilder |
getQueryBuilder()
|
protected String |
getQueryRepresentation()
|
protected Collection<String> |
getReservedWords()
|
protected int |
getResultsToReturn()
|
BaseSearchConfiguration |
getSearchConfiguration()
Returns the configuration associated with this search command. |
protected ResultList<ResultItem> |
getSearchResult(String id,
DataModel datamodel)
Get the results from another search command waiting if neccessary. |
protected String |
getSingleParameter(String paramName)
Deprecated. use getParameter(string) instead |
String |
getTransformedQuery()
Returns the query as it is after the query transformers and command specific query builder have been applied to it. |
protected String |
getTransformedQuerySesamSyntax()
Returns the query as it is after the query transformers have been applied to it. |
protected Map<Clause,String> |
getTransformedTerms()
|
protected String |
getUserSortBy()
Returns the userSortBy applicable to this command and request. |
boolean |
handleCancellation()
Handles cancelling the command. |
protected void |
initialiseTransformedTerms(Query query)
Set (or reset) the transformed terms back to the state before any queryTransformers were run. |
boolean |
isCancelled()
Has the command been cancelled. |
boolean |
isPaginated()
Can this command provide paginated results. |
boolean |
isUserSortable()
Can this command be sorted differently at user's requst. |
protected ResultList<ResultItem> |
performExecution()
Handles the execution process. |
protected void |
performQueryTransformation()
|
protected void |
performResultHandling(ResultList<ResultItem> result)
Perform (delegating out to) all registered result handlers for this command. |
protected void |
setTransformedQuerySesamSyntax(String sesamSyntax)
|
protected void |
statisticsInfo(String msg)
|
String |
toString()
|
protected void |
updateTransformedQuerySesamSyntax()
|
protected void |
visitXorClause(no.sesat.commons.visitor.Visitor visitor,
XorClause clause)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected static final Logger DUMP
protected final transient SearchCommand.Context context
protected final String untransformedQuery
protected final transient DataModel datamodel
protected final transient Map<String,StringDataObject> datamodelParameters
protected volatile boolean completed
| Constructor Detail |
|---|
public AbstractSearchCommand(SearchCommand.Context cxt)
cxt - The context to execute in.| Method Detail |
|---|
protected final void initialiseTransformedTerms(Query query)
query - the query that the transformedTerms map will be constructed from. This should match getQuery()public abstract ResultList<ResultItem> execute()
public Query getQuery()
public String getTransformedQuery()
public String toString()
toString in class Objectpublic BaseSearchConfiguration getSearchConfiguration()
SearchCommand
getSearchConfiguration in interface SearchCommandpublic ResultList<ResultItem> call()
call in interface Callable<ResultList<ResultItem>>call in interface SearchCommandpublic boolean handleCancellation()
handleCancellation in interface SearchCommandpublic boolean isCancelled()
isCancelled in interface SearchCommand
protected QueryBuilder constructQueryBuilder(SearchCommand.Context cxt,
QueryBuilder.Context queryBuilderContext)
cxt - search command's contextqueryBuilderContext - the query builder context
protected Collection<String> getReservedWords()
protected void visitXorClause(no.sesat.commons.visitor.Visitor visitor,
XorClause clause)
visitor - clause -
protected final ResultList<ResultItem> getSearchResult(String id,
DataModel datamodel)
throws InterruptedException
id - datamodel -
InterruptedExceptionprotected void performQueryTransformation()
protected final ResultList<ResultItem> performExecution()
protected final void performResultHandling(ResultList<ResultItem> result)
result - protected int getCurrentOffset(int i)
i - the current offset.
protected int getOffset()
public boolean isPaginated()
SearchCommand
isPaginated in interface SearchCommandprotected String getUserSortBy()
public boolean isUserSortable()
SearchCommand
isUserSortable in interface SearchCommandprotected String getParameter(String paramName)
paramName - the name of the parameter to look for.
protected QueryBuilder getQueryBuilder()
protected String getQueryRepresentation()
protected FilterBuilder getFilterBuilder()
protected String getFilter()
protected final Map<Clause,String> getTransformedTerms()
protected final String getSingleParameter(String paramName)
paramName - parameter name
protected TokenEvaluationEngine getEngine()
protected final AbstractSearchCommand.ReconstructedQuery createQuery(String queryString)
queryString - the new query string to parse.
protected final AbstractSearchCommand.ReconstructedQuery createQuery(String queryString,
boolean evaluationEnabled)
queryString - the new query string to parse.evaluationEnabled - whether to enable evaluation. if false the DeadTokenEvaluationEngineImpl is used.
protected String escape(String word)
word - The term to escape
protected final String getFieldFilter(LeafClause clause)
clause -
protected final void statisticsInfo(String msg)
protected String getTransformedQuerySesamSyntax()
protected void updateTransformedQuerySesamSyntax()
protected void setTransformedQuerySesamSyntax(String sesamSyntax)
protected void addFilterString(String filter)
filter - protected int getResultsToReturn()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||