Search in sources :

Example 16 with IndexArgs

use of io.anserini.index.IndexArgs in project Anserini by castorini.

the class AclAnthologyEndToEndTest method getIndexArgs.

@Override
public IndexArgs getIndexArgs() {
    IndexArgs indexArgs = createDefaultIndexArgs();
    indexArgs.input = "src/test/resources/sample_docs/acl";
    indexArgs.collectionClass = AclAnthology.class.getSimpleName();
    indexArgs.generatorClass = AclAnthologyGenerator.class.getSimpleName();
    return indexArgs;
}
Also used : AclAnthologyGenerator(io.anserini.index.generator.AclAnthologyGenerator) IndexArgs(io.anserini.index.IndexArgs) AclAnthology(io.anserini.collection.AclAnthology)

Example 17 with IndexArgs

use of io.anserini.index.IndexArgs in project Anserini by castorini.

the class SolrEndToEndTest method testIndexAndSearch.

@Test
public void testIndexAndSearch() throws Exception {
    String schemaAdjustmentFile = getSchemaAdjustmentFile();
    if (schemaAdjustmentFile != null) {
        // update schema, much like curl -X POST -H 'Content-type:application/json' --data-binary SCHEMA_NAME.json http://localhost:8983/solr/COLLECTION_NAME/schema
        String schemaJson = Files.readString(getFile(schemaAdjustmentFile).toPath());
        DirectJsonQueryRequest schemaRequest = new DirectJsonQueryRequest(schemaJson, params(CommonParams.QT, "/schema"));
        QueryResponse response = schemaRequest.process(client, getCollectionName());
        assertEquals(0, response.getStatus());
    }
    IndexArgs indexArgs = getIndexArgs();
    IndexCollection indexRunner = getIndexRunner(indexArgs);
    indexRunner.run();
    SearchSolr.Args searchArgs = getSearchArgs();
    SearchSolr searchRunner = getSearchRunner(searchArgs);
    searchRunner.runTopics();
    BufferedReader br = new BufferedReader(new FileReader(searchArgs.output));
    String[] ref = getRefRankingResult();
    String s;
    int cnt = 0;
    while ((s = br.readLine()) != null) {
        assertEquals(ref[cnt], s);
        cnt++;
    }
    assertEquals(cnt, ref.length);
    FileUtils.deleteQuietly(new File(searchArgs.output));
}
Also used : SearchSolr(io.anserini.search.SearchSolr) QueryResponse(org.apache.solr.client.solrj.response.QueryResponse) IndexArgs(io.anserini.index.IndexArgs) BufferedReader(java.io.BufferedReader) FileReader(java.io.FileReader) DirectJsonQueryRequest(org.apache.solr.client.solrj.request.json.DirectJsonQueryRequest) File(java.io.File) IndexCollection(io.anserini.index.IndexCollection) Test(org.junit.Test)

Example 18 with IndexArgs

use of io.anserini.index.IndexArgs in project Anserini by castorini.

the class SolrEndToEndTest method createDefaultIndexArgs.

protected IndexArgs createDefaultIndexArgs() {
    IndexArgs args = new IndexArgs();
    args.solrIndex = getCollectionName();
    args.threads = 1;
    args.storePositions = true;
    args.storeDocvectors = true;
    args.storeContents = true;
    args.storeRaw = true;
    args.optimize = true;
    args.quiet = true;
    args.solr = true;
    return args;
}
Also used : IndexArgs(io.anserini.index.IndexArgs)

Example 19 with IndexArgs

use of io.anserini.index.IndexArgs in project Anserini by castorini.

the class AclAnthologyEndToEndTest method getIndexArgs.

@Override
protected IndexArgs getIndexArgs() {
    IndexArgs indexArgs = createDefaultIndexArgs();
    indexArgs.input = "src/test/resources/sample_docs/acl";
    indexArgs.collectionClass = AclAnthology.class.getSimpleName();
    indexArgs.generatorClass = AclAnthologyGenerator.class.getSimpleName();
    return indexArgs;
}
Also used : AclAnthologyGenerator(io.anserini.index.generator.AclAnthologyGenerator) IndexArgs(io.anserini.index.IndexArgs) AclAnthology(io.anserini.collection.AclAnthology)

Example 20 with IndexArgs

use of io.anserini.index.IndexArgs in project Anserini by castorini.

the class MultiThreadingSearchTest method getIndexArgs.

@Override
protected IndexArgs getIndexArgs() {
    IndexArgs indexArgs = createDefaultIndexArgs();
    indexArgs.input = "src/test/resources/sample_docs/trec/collection2";
    indexArgs.collectionClass = TrecCollection.class.getSimpleName();
    return indexArgs;
}
Also used : TrecCollection(io.anserini.collection.TrecCollection) IndexArgs(io.anserini.index.IndexArgs)

Aggregations

IndexArgs (io.anserini.index.IndexArgs)22 TrecCollection (io.anserini.collection.TrecCollection)6 CoreCollection (io.anserini.collection.CoreCollection)3 JsonCollection (io.anserini.collection.JsonCollection)3 DefaultLuceneDocumentGenerator (io.anserini.index.generator.DefaultLuceneDocumentGenerator)3 Before (org.junit.Before)3 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)2 ObjectNode (com.fasterxml.jackson.databind.node.ObjectNode)2 AclAnthology (io.anserini.collection.AclAnthology)2 AclAnthologyGenerator (io.anserini.index.generator.AclAnthologyGenerator)2 CoreGenerator (io.anserini.index.generator.CoreGenerator)2 BibtexCollection (io.anserini.collection.BibtexCollection)1 C4Collection (io.anserini.collection.C4Collection)1 JsonVectorCollection (io.anserini.collection.JsonVectorCollection)1 TweetCollection (io.anserini.collection.TweetCollection)1 IndexCollection (io.anserini.index.IndexCollection)1 BibtexGenerator (io.anserini.index.generator.BibtexGenerator)1 C4Generator (io.anserini.index.generator.C4Generator)1 TweetGenerator (io.anserini.index.generator.TweetGenerator)1 SearchSolr (io.anserini.search.SearchSolr)1