public class SearchHelper
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
QueryBuilder |
builder
the QueryBuilder used to create the query
|
boolean |
compressed
piggyback: if
true , files in opengrok's data directory are
gzipped compressed. |
java.lang.String |
contextPath
context path, i.e.
|
java.io.File |
dataRoot
opengrok's data root: used to find the search index file
|
EftarFileReader |
desc
piggyback: the eftar filereader to use.
|
java.lang.String |
errorMsg
if not
null , the UI should show this error message and stop
processing the search. |
HistoryContext |
historyContext
history context usually created via
prepareSummary() . |
org.apache.lucene.search.ScoreDoc[] |
hits
list of docs which result from the executing the query
|
boolean |
isCrossRefSearch
Indicate, whether this is search from a cross reference.
|
int |
maxItems
max.
|
SortOrder |
order
the order to use to ordery query results
|
boolean |
parallel
if
true a ParallelMultiSearcher will be used instead of
a MultiSearcher . |
static java.lang.String |
PARSE_ERROR_MSG
Default query parse error message prefix
|
java.util.SortedSet<java.lang.String> |
projects
projects to use to setup indexer searchers.
|
org.apache.lucene.search.Query |
query
the query created by the used
QueryBuilder via
prepareExec(SortedSet) . |
java.lang.String |
redirect
if not
null , the consumer should redirect the client to a
separate result page denoted by the value of this field. |
org.apache.lucene.search.Searcher |
searcher
the searcher used to open/search the index.
|
protected org.apache.lucene.search.Sort |
sort
the lucene sort instruction based on
order created via
prepareExec(SortedSet) . |
Context |
sourceContext
opengrok summary context.
|
java.io.File |
sourceRoot
piggyback: the source root directory.
|
int |
start
the result cursor start index, i.e.
|
Summarizer |
summerizer
result summarizer usually created via
prepareSummary() . |
int |
totalHits
total number of hits
|
Constructor and Description |
---|
SearchHelper() |
Modifier and Type | Method and Description |
---|---|
void |
destroy()
Free any resources associated with this helper (that includes closing
the used
searcher ). |
SearchHelper |
executeQuery()
Start the search prepared by
prepareExec(SortedSet) . |
java.util.List<Suggestion> |
getSuggestions()
If a search did not return a hit, one may use this method to obtain
suggestions for a new search.
|
SearchHelper |
prepareExec(java.util.SortedSet<java.lang.String> projects)
Create the searcher to use wrt.
|
SearchHelper |
prepareSummary()
Prepare the fields to support printing a fullblown summary.
|
public java.io.File dataRoot
public java.lang.String contextPath
public boolean compressed
true
, files in opengrok's data directory are
gzipped compressed.public java.io.File sourceRoot
public EftarFileReader desc
public int start
public int maxItems
public QueryBuilder builder
public SortOrder order
public boolean parallel
true
a ParallelMultiSearcher
will be used instead of
a MultiSearcher
.public boolean isCrossRefSearch
true
executeQuery()
sets redirect
if certain conditions are
met.public java.lang.String redirect
null
, the consumer should redirect the client to a
separate result page denoted by the value of this field. Automatically
set via prepareExec(SortedSet)
and executeQuery()
.public java.lang.String errorMsg
null
, the UI should show this error message and stop
processing the search. Automatically set via prepareExec(SortedSet)
and executeQuery()
.public org.apache.lucene.search.Searcher searcher
prepareExec(SortedSet)
.public org.apache.lucene.search.ScoreDoc[] hits
public int totalHits
public org.apache.lucene.search.Query query
QueryBuilder
via
prepareExec(SortedSet)
.protected org.apache.lucene.search.Sort sort
order
created via
prepareExec(SortedSet)
.public java.util.SortedSet<java.lang.String> projects
prepareExec(SortedSet)
.public Context sourceContext
prepareSummary()
.public Summarizer summerizer
prepareSummary()
.public HistoryContext historyContext
prepareSummary()
.public static final java.lang.String PARSE_ERROR_MSG
public SearchHelper prepareExec(java.util.SortedSet<java.lang.String> projects)
redirect
link. It also does
nothing if redirect
or errorMsg
have a none-null
value.
Parameters which should be populated/set at this time:
Populates/sets:projects
- project to use query. If empty, a none-project opengrok
setup is assumed (i.e. DATA_ROOT/index will be used instead of possible
multiple DATA_ROOT/$project/index).public SearchHelper executeQuery()
prepareExec(SortedSet)
.
It does nothing if redirect
or errorMsg
have a
none-null
value.
Parameters which should be populated/set at this time:
prepareExec(SortedSet)
)start
(default: 0)maxItems
(default: 0)isCrossRefSearch
(default: false)hits
(see TopDocs.scoreDocs
)totalHits
(see TopDocs.totalHits
)contextPath
errorMsg
if an error occursredirect
if certain conditions are metpublic java.util.List<Suggestion> getSuggestions()
Parameters which should be populated/set at this time:
public SearchHelper prepareSummary()
redirect
or errorMsg
have a none-null
value.
Parameters which should be populated/set at this time:
Populates/sets: Otherwise the following fields are set (includesnull
):
public void destroy()
searcher
).