本文整理汇总了Java中org.galagosearch.core.retrieval.Retrieval类的典型用法代码示例。如果您正苦于以下问题:Java Retrieval类的具体用法?Java Retrieval怎么用?Java Retrieval使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Retrieval类属于org.galagosearch.core.retrieval包,在下文中一共展示了Retrieval类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: handleSearch
import org.galagosearch.core.retrieval.Retrieval; //导入依赖的package包/类
private static void handleSearch(String[] args) throws Exception {
if (args.length <= 1) {
commandHelp("search");
return;
}
String indexPath = args[1];
String[][] filtered = Utility.filterFlags(Utility.subarray(args, 2));
String[] flags = filtered[0];
String[] corpusFiles = filtered[1];
// Any flag marked '--parameters' marks a parameters file.
// We trim that part of the flag off so that the Parameters object will
// load it as a parameters file.
for (int i = 0; i < flags.length; ++i) {
flags[i] = flags[i].replace("--parameters=", "");
}
Parameters p = new Parameters(flags);
Retrieval retrieval = Retrieval.instance(indexPath, p);
handleSearch(retrieval, getDocumentStore(corpusFiles));
}
示例2: handleSearch
import org.galagosearch.core.retrieval.Retrieval; //导入依赖的package包/类
private void handleSearch(String[] args) throws Exception {
if (args.length <= 1) {
commandHelp("search");
return;
}
String indexPath = args[1];
String[][] filtered = Utility.filterFlags(Utility.subarray(args, 2));
String[] flags = filtered[0];
String[] corpusFiles = filtered[1];
// Any flag marked '--parameters' marks a parameters file.
// We trim that part of the flag off so that the Parameters object will
// load it as a parameters file.
for (int i = 0; i < flags.length; ++i) {
flags[i] = flags[i].replace("--parameters=", "");
}
Parameters p = new Parameters(flags);
Retrieval retrieval = Retrieval.instance(indexPath, p);
handleSearch(retrieval, getDocumentStore(corpusFiles));
}
示例3: main
import org.galagosearch.core.retrieval.Retrieval; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
// read in parameters
Parameters parameters = new Parameters(args);
List<Parameters.Value> queries = parameters.list("query");
// open index
Retrieval retrieval = Retrieval.instance(parameters.get("index"), parameters);
// record results requested
int requested = (int) parameters.get("count", 1000);
// for each query, run it, get the results, look up the docnos, print in TREC format
for (Parameters.Value query : queries) {
// parse the query
String queryText = query.get("text");
Node queryRoot = parseQuery(queryText, parameters);
ScoredDocument[] results = retrieval.runQuery(queryRoot, requested);
for (int i = 0; i < results.length; i++) {
String document = retrieval.getDocumentName(results[i].document);
double score = results[i].score;
int rank = i + 1;
System.out.format("%s Q0 %s %d %s galago\n", query.get("number"), document, rank,
formatScore(score));
}
}
}
示例4: run
import org.galagosearch.core.retrieval.Retrieval; //导入依赖的package包/类
public static void run(String[] args, PrintStream out) throws Exception {
// read in parameters
Parameters parameters = new Parameters(args);
List<Parameters.Value> queries = parameters.list("query");
// open index
Retrieval retrieval = Retrieval.instance(parameters.get("index"), parameters);
// record results requested
int requested = (int) parameters.get("count", 1000);
// for each query, run it, get the results, look up the docnos, print in TREC format
for (Parameters.Value query : queries) {
// parse the query
String queryText = query.get("text");
Node queryRoot = parseQuery(queryText, parameters);
queryRoot = retrieval.transformQuery(queryRoot);
ScoredDocument[] results = retrieval.runQuery(queryRoot, requested);
for (int i = 0; i < results.length; i++) {
String document = retrieval.getDocumentName(results[i].document);
double score = results[i].score;
int rank = i + 1;
out.format("%s Q0 %s %d %s galago\n", query.get("number"), document, rank,
formatScore(score));
}
}
}
示例5: run
import org.galagosearch.core.retrieval.Retrieval; //导入依赖的package包/类
public static void run(String[] args, final PrintStream out) throws Exception {
// read in parameters
final Parameters parameters = new Parameters(args);
final List<Parameters.Value> queries = parameters.list("query");
final int requested = (int) parameters.get("count", 1000);
AsyncTaskService.get().init();
// TermAssociationManager를 먼저 init 해둬야 함. 그래야 Thread-safe.
TermAssociationManager.get().init();
final int[] asyncIndex = {0};
for (final Parameters.Value query : queries) {
AsyncTaskService.get().runTask(AsyncTaskService.HIGH_PERFORMANCE, new Runnable() {
@Override
public void run() {
try {
// open index
final Retrieval retrieval = Retrieval.instance(parameters.get("index"), parameters);
String queryText = query.get("text");
// IntApp modified.
String modquery = QueryModifier.modifyQuery(queryText);
Node queryRoot = parseQuery(modquery, parameters);
queryRoot = retrieval.transformQuery(queryRoot);
ScoredDocument[] results = retrieval.runQuery(queryRoot, requested);
for (int i = 0; i < results.length; i++) {
String document = retrieval.getDocumentName(results[i].document);
double score = results[i].score;
int rank = i + 1;
System.out.print(String.format("%s Q0 %s %d %s galago\n", query.get("number"), document, rank,
formatScore(score)));
}
asyncIndex[0]++;
if (asyncIndex[0] == queries.size())
System.exit(0);
} catch (Exception ex) {
Thread t = Thread.currentThread();
t.getUncaughtExceptionHandler().uncaughtException(t, ex);
}
}
});
}
}