|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.sun.labs.minion.retrieval.ResultSetImpl
public class ResultSetImpl
An implementation of the results set interface.
| Nested Class Summary | |
|---|---|
class |
ResultSetImpl.AGDocs
|
| Field Summary | |
|---|---|
protected CollectionStats |
cs
The statistics for the collection. |
protected SearchEngine |
e
The search engine that is creating the results set. |
protected HLPipeline |
hlp
A pipeline that can be used for highlighting documents from this set. |
protected static java.lang.String |
logTag
|
protected QueryConfig |
qc
The configuration used for the query that generated this results set. |
protected QueryElement |
query
The query, as provided by tmhe user. |
protected long |
queryTime
The time spent parsing and evaluating the query, in milliseconds. |
protected java.util.List<ArrayGroup> |
results
The results of the search: a list of ArrayGroups. |
protected ResultsFilter |
rf
A results filter to use when getting results. |
protected SortSpec |
sortSpec
The sorting specification for this query. |
| Constructor Summary | |
|---|---|
ResultSetImpl(QueryElement query,
QueryConfig qc,
QueryStats qs,
java.util.List partitions,
SearchEngine e)
Creates a result set for the given query by evaluating the query. |
|
ResultSetImpl(ResultSetImpl parent,
ResultSetImpl.AGDocs[] docs)
Constructs a partial result set from the docs passed in. |
|
ResultSetImpl(SearchEngine e)
Creates an empty result set. |
|
ResultSetImpl(SearchEngine e,
QueryConfig qc,
java.util.List results)
Creates a result set from a list of groups. |
|
ResultSetImpl(SearchEngine e,
java.lang.String spec,
java.util.List results)
Creates a result set from a list of groups. |
|
| Method Summary | |
|---|---|
java.util.Set<ResultsCluster> |
cluster(int k)
Clusters the results into this set into a number of clusters. |
java.util.Set<ResultsCluster> |
cluster(java.lang.String field,
int k)
Clusters the results into this set into a number of clusters. |
ResultSet |
difference(ResultSet rs)
Computes the difference of this result set and another result set. |
java.util.List<Result> |
getAllResults(boolean sorted)
Gets all of the query results in the set. |
java.util.List<Result> |
getAllResults(boolean sorted,
ResultsFilter rf)
Gets all of the query results in the set. |
SearchEngine |
getEngine()
Gets the search engine that generated this results set. |
HLPipeline |
getHLPipeline()
Gets the highlighting pipeline. |
int |
getNumDocs()
Gets the number of documents that are in the whole index. |
QueryStats |
getQueryStats()
Gets the statistics for the query that generated this set. |
long |
getQueryTime()
Gets the amount of time that it took to evaluate the query, in milliseconds. |
java.util.List<Result> |
getResults(int start,
int n)
Gets a subset of the query results stored in this set. |
java.util.List<Result> |
getResults(int start,
int n,
ResultsFilter rf)
Gets a subset of the query results stored in this set. |
java.util.List<Result> |
getResultsForScoredField(int start,
int n,
java.lang.String field,
java.lang.Object value,
java.lang.String scoreField)
Gets the results from this result set ranked using a score field that is associated with another field. |
java.util.Set<ResultsCluster> |
groupBy(java.lang.String field,
boolean ignoreCase)
Groups the results in this set into a number of clusters. |
ResultSet |
intersect(ResultSet rs)
Computes the intersection of this result set with another result set. |
ResultSetImpl.AGDocs |
newAGDocs(ArrayGroup ag)
|
boolean |
querySyntaxError()
Indicates whether the query contained a syntax error. |
java.util.Iterator<ArrayGroup> |
resultsIterator()
Gets an iterator for the per-partition results. |
boolean |
same(ResultSetImpl other)
A method to test whether two result sets are the same. |
void |
setQueryStats(QueryStats qs)
|
void |
setResultsFilter(ResultsFilter rf)
Sets the results filter that will be used to decide whether results should be returned from this set. |
void |
setScoreModifier(ScoreModifier sm)
Sets the score modifier that will be used to modify the scores of the documents returned from this set. |
void |
setSortSpec(java.lang.String sortSpec)
Sets the sorting specification used by this result set. |
int |
size()
Gets the size of the results set, that is, the number of documents that matched the query. |
ResultSet |
union(ResultSet rs)
Computes the intersection of this result set with another result set. |
ResultSet |
weight(float w)
Weights the results in this set. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected QueryElement query
protected SearchEngine e
protected QueryConfig qc
protected CollectionStats cs
protected SortSpec sortSpec
protected ResultsFilter rf
protected java.util.List<ArrayGroup> results
protected HLPipeline hlp
protected long queryTime
protected static java.lang.String logTag
| Constructor Detail |
|---|
public ResultSetImpl(SearchEngine e)
public ResultSetImpl(QueryElement query,
QueryConfig qc,
QueryStats qs,
java.util.List partitions,
SearchEngine e)
query - The query typed by the user.
query.e - The engine against which we will run the query.qs - The statistics to accumulate for this query.qc - The query configuration for this query.partitions - The partitions against which we will run the
query.
public ResultSetImpl(ResultSetImpl parent,
ResultSetImpl.AGDocs[] docs)
parent - the full result set that this is a subsest ofdocs - the docs to be included in this subset
public ResultSetImpl(SearchEngine e,
QueryConfig qc,
java.util.List results)
public ResultSetImpl(SearchEngine e,
java.lang.String spec,
java.util.List results)
| Method Detail |
|---|
public SearchEngine getEngine()
getEngine in interface ResultSetpublic void setSortSpec(java.lang.String sortSpec)
ResultSet
setSortSpec in interface ResultSetsortSpec - a sorting specification for this result set.public void setResultsFilter(ResultsFilter rf)
ResultSet
setResultsFilter in interface ResultSetrf - the results filter to useResultsFilter,
CompositeResultsFilterpublic void setScoreModifier(ScoreModifier sm)
ResultSet
setScoreModifier in interface ResultSetsm - the score modifier to use
public java.util.List<Result> getResultsForScoredField(int start,
int n,
java.lang.String field,
java.lang.Object value,
java.lang.String scoreField)
throws SearchEngineException
start - the position in the ranked list to start getting resultsn - the number of results to returnfield - the field containing the values that the search was done withvalue - the value that we searched for in the fieldscoreField - the field containing the scores associated with the field
SearchEngineException - if there is any exception
getting the results
public java.util.List<Result> getResults(int start,
int n)
throws SearchEngineException
getResults in interface ResultSetstart - The position in the set to start getting results,
indexed from 0.n - The number of results to get. Note that you may get less
than this number of results if there are insufficient results in the
set.
Result instances containing the
search results.
SearchEngineException - if there is some error getting the
results.
public java.util.List<Result> getResults(int start,
int n,
ResultsFilter rf)
throws SearchEngineException
getResults in interface ResultSetstart - The position in the set to start getting results,
indexed from 0.n - The number of results to get. Note that you may get less
than this number of results if there are insufficient results in the
set.rf - a filter that will be used to determine whether results
should be put on the heap or not.
Result instances containing the
search results.
SearchEngineException - if there is some error getting the
results.
public java.util.List<Result> getAllResults(boolean sorted)
throws SearchEngineException
getAllResults in interface ResultSetsorted - If true, then the results will be sorted
according to the sorting specification that was provided with the
query. If false, then the results will be returned in
an arbitrary order.
SearchEngineException - if there is any error processing the result set
public java.util.List<Result> getAllResults(boolean sorted,
ResultsFilter rf)
throws SearchEngineException
getAllResults in interface ResultSetsorted - If true, then the results will be sorted
according to the sorting specification that was provided with the
query. If false, then the results will be returned in
an arbitrary order.rf - a filter to use to decide which results from the search should
be added to the list. If this is null, then no filter will
be applied.
SearchEngineException - if there is any error processing the result setpublic void setQueryStats(QueryStats qs)
public QueryStats getQueryStats()
ResultSet
getQueryStats in interface ResultSetpublic boolean querySyntaxError()
querySyntaxError in interface ResultSettrue if there was such an error,
false otherwise.public int size()
size in interface ResultSetquerySyntaxError()public HLPipeline getHLPipeline()
public int getNumDocs()
getNumDocs in interface ResultSetpublic long getQueryTime()
getQueryTime in interface ResultSetpublic java.util.Iterator<ArrayGroup> resultsIterator()
public ResultSetImpl.AGDocs newAGDocs(ArrayGroup ag)
public java.util.Set<ResultsCluster> cluster(int k)
throws SearchEngineException
ResultSet
cluster in interface ResultSetk - the maximum number of clusters to return
k
SearchEngineException - if there are any errors generating the clustersResultsCluster
public java.util.Set<ResultsCluster> cluster(java.lang.String field,
int k)
throws SearchEngineException
ResultSet
cluster in interface ResultSetfield - the name of a vectored field upon which the clustering
should be based. A value of null indicates that all vectored
fields should be considered, while an empty string indicates that data
in no explicit field should be considered.k - the maximum number of clusters to return
k
SearchEngineException - if there are any errors generating the clustersResultsCluster
public java.util.Set<ResultsCluster> groupBy(java.lang.String field,
boolean ignoreCase)
throws SearchEngineException
ResultSet
groupBy in interface ResultSetfield - the name of the field for which we wish to group the resultsignoreCase - if true case will not be taken into account when
grouping the results. Clearly, this only makes sense for string fields.
SearchEngineException - if there are any errors grouping the
resultspublic ResultSet weight(float w)
ResultSet
weight in interface ResultSetw - a weight to apply multiplicatively to each of the scores in
this set.
public ResultSet intersect(ResultSet rs)
ResultSet
intersect in interface ResultSetrs - the result set with which this set will be intersected.
public ResultSet union(ResultSet rs)
ResultSet
union in interface ResultSetrs - the result set with which this set will be intersected.
public ResultSet difference(ResultSet rs)
ResultSet
difference in interface ResultSetrs - the result set with which this set will be intersected.
public boolean same(ResultSetImpl other)
other - the other set to test against this one.
true if the documents contain the same documents
and the documents have the same scores, false otherwise.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||