public class TRECQuerying extends Object
In the following, we list the main ways for configuring TRECQuerying, before exhaustively listing the properties that can affect TRECQuerying.
<top> <num> Number 1 </num> <title> Query terms </title> <desc> Description : A setence about the information need </desc> <narr> Narrative: More sentences about what is relevant or not</narr> </top>If you have a topic files in a different format, you can used a differed QuerySource by setting the property trec.topics.parser. For instance trec.topics.parser=SingleLineTRECQuery should be used for topics where one line is one query. See
TRECQuery
and SingleLineTRECQuery
for more information.
InL2
retrieval model for all runs.
If the trec.model property is specified, then all runs will be made
using that weighting model. You can change this by specifying another
model using the property trec.model. E.g., to use
PL2
, set trec.model=PL2.
Similarly, when query expansion is enabled, the
default query expansion model is Bo1
, controlled by the property
trec.qe.model.
TRECQuery
by default. Subclass the TRECQuery
class and alter this property if
your topics come in a very different format to those of TREC. TRECDocnoOutputFormat
. Alternatives: TRECDocnoOutputFormat
, TRECDocidOutputFormat
, NullOutputFormat
TRECDocnoOutputFormat
, defines the
MetaIndex key to use as the docno. Defaults to "docno".
NullQueryResultCache
Modifier and Type | Field and Description |
---|---|
protected String |
defaultQEModel
The name of the query expansion model used.
|
protected static boolean |
DUMP_SETTINGS
Dump the current settings along with the results.
|
protected Index |
index
The object that encapsulates the data structures used by Terrier.
|
protected static String |
ITERATION
A TREC specific output field.
|
protected static org.slf4j.Logger |
logger
The logger used
|
protected String |
managerName
The name of the manager object that handles the queries.
|
protected int |
matchingCount
The number of matched queries.
|
protected String |
method
The method - ie the weighting model and parameters.
|
protected String |
mModel
The name of the matching model that is used for retrieval.
|
protected OutputFormat |
printer
Where results of the stream of queries are output to.
|
protected boolean |
queryexpansion
the boolean indicates whether to expand queries
|
protected Manager |
queryingManager
The manager object that handles the queries.
|
protected QuerySource |
querySource
Where the stream of queries is obtained from.
|
protected static Random |
random
random number generator
|
protected static boolean |
removeQueryPeriods |
protected PrintWriter |
resultFile
The file to store the output to.
|
protected OutputStream |
resultFileRaw |
protected static int |
RESULTS_LENGTH
The number of results to output.
|
protected QueryResultCache |
resultsCache
results are obtained a query cache is one is enabled.
|
protected String |
resultsFilename
The filename of the last file results were output to.
|
protected String |
topicsParser
What class parse to parse the batch topic files.
|
protected String |
wModel
The name of the weighting model that is used for retrieval.
|
Constructor and Description |
---|
TRECQuerying()
TRECQuerying default constructor initialises the inverted index, the
lexicon and the document index structures.
|
TRECQuerying(boolean _queryexpansion)
TRECQuerying constructor initialises the inverted index, the
lexicon and the document index structures.
|
TRECQuerying(Index i)
TRECQuerying constructor initialises the specified inverted index, the
lexicon and the document index structures.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the used structures.
|
protected void |
createManager()
Create a querying manager.
|
protected void |
finishedQueries()
After finishing with a batch of queries, close the result file
|
Index |
getIndex()
Get the index pointer.
|
Manager |
getManager()
Get the querying manager.
|
protected String |
getNextQueryCounter(String resultsFolder)
Get the sequential number of the next result file in the results folder.
|
protected OutputFormat |
getOutputFormat() |
protected QuerySource |
getQueryParser()
Get the query parser that is being used.
|
protected String |
getRandomQueryCounter()
Get a random number between 0 and 1000.
|
PrintWriter |
getResultFile(String predefinedName)
Returns a PrintWriter used to store the results.
|
protected QueryResultCache |
getResultsCache()
Obtain the query cache.
|
protected String |
getSequentialQueryCounter(String resultsFolder)
Get the sequential number of the current result file in the results
folder.
|
protected void |
initSearchRequestModification(String queryId,
SearchRequest srq) |
protected void |
loadIndex()
Loads index(s) from disk.
|
protected void |
preQueryingSearchRequestModification(String queryId,
SearchRequest srq) |
void |
printSettings(SearchRequest default_q,
String[] topicsFiles,
String otherComments)
prints the current settings to a file with the same name as the current
results file.
|
String |
processQueries()
Performs the matching using the specified weighting model from the setup
and possibly a combination of evidence mechanism.
|
String |
processQueries(double c)
Performs the matching using the specified weighting model from the setup
and possibly a combination of evidence mechanism.
|
String |
processQueries(double c,
boolean c_set)
Performs the matching using the specified weighting model from the setup
and possibly a combination of evidence mechanism.
|
SearchRequest |
processQuery(String queryId,
String query)
According to the given parameters, it sets up the correct matching class
and performs retrieval for the given query.
|
SearchRequest |
processQuery(String queryId,
String query,
double cParameter)
According to the given parameters, it sets up the correct matching class
and performs retrieval for the given query.
|
SearchRequest |
processQuery(String queryId,
String query,
double cParameter,
boolean c_set)
According to the given parameters, it sets up the correct matching class
and performs retrieval for the given query.
|
protected void |
processQueryAndWrite(String queryId,
String query,
double cParameter,
boolean c_set)
According to the given parameters, it sets up the correct matching class
and performs retrieval for the given query.
|
void |
setIndex(Index i)
Set the index pointer.
|
protected void |
startingBatchOfQueries()
Before starting a batch of queries, this method is called by
processQueries()
|
protected String defaultQEModel
protected static final org.slf4j.Logger logger
protected static boolean removeQueryPeriods
protected static final Random random
protected int matchingCount
protected boolean queryexpansion
protected PrintWriter resultFile
protected OutputStream resultFileRaw
protected String resultsFilename
protected static boolean DUMP_SETTINGS
protected String managerName
protected Manager queryingManager
protected String wModel
protected String mModel
protected Index index
protected static int RESULTS_LENGTH
protected static String ITERATION
protected String method
protected String topicsParser
protected QuerySource querySource
protected OutputFormat printer
protected QueryResultCache resultsCache
public TRECQuerying()
public TRECQuerying(boolean _queryexpansion)
public TRECQuerying(Index i)
i
- The specified index.protected QueryResultCache getResultsCache()
protected OutputFormat getOutputFormat()
protected void createManager()
protected void loadIndex()
public Index getIndex()
public void setIndex(Index i)
i
- The index pointer.public Manager getManager()
public void close()
protected String getNextQueryCounter(String resultsFolder)
resultsFolder
- The path of the results folder.protected String getRandomQueryCounter()
protected String getSequentialQueryCounter(String resultsFolder)
resultsFolder
- The path of the results folder.public PrintWriter getResultFile(String predefinedName)
predefinedName
- java.lang.String a non-standard prefix for the result file.public SearchRequest processQuery(String queryId, String query)
queryId
- the identifier of the query to process.query
- the query to process.public SearchRequest processQuery(String queryId, String query, double cParameter)
queryId
- the identifier of the query to process.query
- the query to process.cParameter
- double the value of the parameter to use.protected void processQueryAndWrite(String queryId, String query, double cParameter, boolean c_set)
queryId
- the identifier of the query to process.query
- the query to process.cParameter
- double the value of the parameter to use.c_set
- A boolean variable indicating if cParameter has been
specified.public SearchRequest processQuery(String queryId, String query, double cParameter, boolean c_set)
queryId
- the identifier of the query to process.query
- the query to process.cParameter
- double the value of the parameter to use.c_set
- boolean specifies whether the parameter c is set.protected void preQueryingSearchRequestModification(String queryId, SearchRequest srq)
protected void initSearchRequestModification(String queryId, SearchRequest srq)
public String processQueries()
public String processQueries(double c)
c
- double the value of the term frequency parameter to use.protected QuerySource getQueryParser()
public String processQueries(double c, boolean c_set)
Queries
Queries are parsed from file, specified by the trec.topics property
(comma delimited)
c
- the value of c.c_set
- specifies whether a value for c has been specified.protected void startingBatchOfQueries()
protected void finishedQueries()
public void printSettings(SearchRequest default_q, String[] topicsFiles, String otherComments)
Terrier Information Retrieval Platform4.1. Copyright © 2004-2015, University of Glasgow