java中terrier信息检索工具maven集成实验返回错误

vdgimpew  于 2021-07-08  发布在  Java
关注(0)|答案(0)|浏览(223)

基本上,我正在使用一个叫做terrier项目的信息检索工具。我参考了文档,因此我想学习terrier搜索引擎与java项目的集成。因此,我尝试使用netbeanside创建java和maven项目,并根据文档使用所需的依赖项更新pom.xml文件。但是当我试着运行这个代码时,它在searchresult上给了我一个错误(请参见以下图片链接)
我甚至在maven repository和maven central repository上都找不到这个工件。灯泡图标来了,但它显示无关的建议。
单击此处查看图像
我关注的文档>>https://github.com/terrier-org/terrier-core/blob/5.x/doc/quickstart-integratedsearchdisk.md
有什么解决办法吗??

public static void main(String[] args) throws Exception {

    // Directory containing files to index
    String aDirectoryToIndex = "/my/directory/containing/files/";

    // Configure Terrier
    ApplicationSetup.setProperty("indexer.meta.forward.keys", "filename");
    ApplicationSetup.setProperty("indexer.meta.forward.keylens", "200");

    Indexer indexer = new BasicIndexer("/path/to/my/index", "data");
    Collection coll = new SimpleFileCollection(Arrays.asList(aDirectoryToIndex), true);
    indexer.index(new Collection[]{coll});
    //indexer.close();

    Index index = Index.createIndex("/path/to/my/index", "data");

    // Set up the querying process
    ApplicationSetup.setProperty("querying.processes", "terrierql:TerrierQLParser,"
    + "parsecontrols:TerrierQLToControls,"
    + "parseql:TerrierQLToMatchingQueryTerms,"
    + "matchopql:MatchingOpQLParser,"
    + "applypipeline:ApplyTermPipeline,"
    + "localmatching:LocalManager$ApplyLocalMatching,"
    + "filters:LocalManager$PostFilterProcess");

    // Enable the decorate enhancement
    ApplicationSetup.setProperty("querying.postfilters", "decorate:org.terrier.querying.SimpleDecorate");

    // Create a new manager run queries
    Manager queryingManager = ManagerFactory.from(index.getIndexRef());

    // Create a search request
    SearchRequest srq = queryingManager.newSearchRequestFromQuery("search for document");

    // Specify the model to use when searching
    srq.setControl(SearchResult.CONTROL_WMODEL, "BM25"); //THERE IS AN ERROR OVER HERE, ITS SHOWING ME A RED LINE ON SEARCHRESULT AND I CANNOT FIND SEARCHRESULT PARAMETER EVEN ON MAVEN REPOSITORY

    // Enable querying processes
    srq.setControl("terrierql", "on");
    srq.setControl("parsecontrols", "on");
    srq.setControl("parseql", "on");
    srq.setControl("applypipeline", "on");
    srq.setControl("localmatching", "on");
    srq.setControl("filters", "on");

    // Enable post filters
    srq.setControl("decorate", "on");

    // Run the search
    queryingManager.runSearchRequest(srq);

    // Get the result set
    ScoredDocList results = srq.getResults();

    // Print the results
    System.out.println("The top "+results.size()+" of documents were returned");
    System.out.println("Document Ranking");
    int rank = 0;
    for(ScoredDoc doc : results) {
        int docid = doc.getDocid();
        double score = doc.getScore();
        String docno = doc.getMetadata("docno");
        System.out.println("   Rank "+ (rank++)+": "+docid+" "+docno+" "+score);
    }

} }

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题