Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/solr/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用SolrQueryParser在Lucene索引或MemoryIndex Java中搜索_Java_Solr_Lucene - Fatal编程技术网

使用SolrQueryParser在Lucene索引或MemoryIndex Java中搜索

使用SolrQueryParser在Lucene索引或MemoryIndex Java中搜索,java,solr,lucene,Java,Solr,Lucene,我想使用Lucene Indexer(进一步称为MemoryIndex)来构建和运行搜索系统。 我使用Lucene查询解析器还可以,但我想用复杂字段和exist schema.xml更新到Solr查询解析器 是将Lucene查询解析器转换为Solr查询解析器并使用Lucene Indexer进行搜索的任何方法 这是我的节目 Analyzer analyzer = new SimpleAnalyzer(Version.LUCENE_48); MemoryIndex index = new Memo

我想使用Lucene Indexer(进一步称为MemoryIndex)来构建和运行搜索系统。 我使用Lucene查询解析器还可以,但我想用复杂字段和exist schema.xml更新到Solr查询解析器

是将Lucene查询解析器转换为Solr查询解析器并使用Lucene Indexer进行搜索的任何方法

这是我的节目

Analyzer analyzer = new SimpleAnalyzer(Version.LUCENE_48);
MemoryIndex index = new MemoryIndex();
index.addField("text", "this is simple text to memory index", analyzer);
QueryParser parser = new QueryParser(Version.LUCENE_48, "text", analyzer); // => Want to change to Sorl Query Parser)
float score = index.search(parser.parse("text:memory"));
if (score > 0.0f) {
    System.out.println("it's a match");         
} else {
    System.out.println("no match found");
}

这基本上意味着您必须实例化一个SolrCore对象,与相关的配置和模式对象一起,然后实例化一个SolrRequest并使用它来创建查询解析器。请看一下ExtendedDismaxQParser的代码。我的问题是:你到底需要从模式文件中得到什么,因为肯定有一种更简单的方法来获得它谢谢你@omu_negru我想要SolrCore,但我想重建它。我想在模式中读取一些字段以添加到查询中。必须有一种更简单的方法。您可以加载一个SolrSchema文件,从那里获取字段和分析器,然后将该映射和一个boost映射一起传递给lucene q ParserTank@omu_negrou!是否通过java编码从Schema.xml和solrconfig.xml创建SolrCore对象和SolrRequest?