Solr SORLJ未定义字段null
我试图通过使用SolrJ对Lucene索引进行简单的读取。我已经能够访问SolrJ下载中提供的示例索引,但在尝试进行读取时出现异常Solr SORLJ未定义字段null,solr,Solr,我试图通过使用SolrJ对Lucene索引进行简单的读取。我已经能够访问SolrJ下载中提供的示例索引,但在尝试进行读取时出现异常 04-feb-2010 17:05:05 org.apache.solr.common.SolrException log GRAVE: org.apache.solr.common.SolrException: undefined field null 我的索引只有一个带有单个字段的文档,称为“nombre” 我在schema.xm
04-feb-2010 17:05:05 org.apache.solr.common.SolrException log
GRAVE: org.apache.solr.common.SolrException: undefined field null
我的索引只有一个带有单个字段的文档,称为“nombre”
我在schema.xml中指定了这一点,在slconfig.xml中指定了路由
Java代码
System.setProperty( "solr.solr.home", "C:\\solr" );
// CREATING THE SERVER
CoreContainer.Initializer initializer = new CoreContainer.Initializer();
CoreContainer coreContainer = null;
SolrServer embServer = null;
coreContainer = initializer.initialize();
embServer = new EmbeddedSolrServer(coreContainer, "");
// READING
SolrQuery query = new SolrQuery();
String q = "*";
query.setQuery(q);
QueryResponse rsp = null;
/// HERE I GET THE EXCEPTION ///
rsp = embServer.query( query );
/// HERE I GET THE EXCEPTION ///
// GETTING THE NUMBER OF ITEMS
SolrDocumentList docs = rsp.getResults();
System.out.println( docs.size() );
有什么想法吗?你能给我一个解决办法吗?这是一个常见的错误吗?事先非常感谢
如果我使用Jetty管理控制台尝试此操作,我会得到: (url:“*”) HTTP错误:400 未定义字段null RequestURI=/solr/select/
shema.xml就是这个: (请记住,我的索引只有一个文档,只有一个字段,称为“nombre”)
solrconfig.xml是这样的:
<?xml version="1.0" encoding="UTF-8" ?>
<config>
<requestHandler name="standard" class="solr.StandardRequestHandler" />
<dataDir>${solr.data.dir:./data/clientes}</dataDir>
</config>
${solr.data.dir:./data/clientes}
我得到的例外是:
<?xml version="1.0" encoding="UTF-8" ?>
<config>
<requestHandler name="standard" class="solr.StandardRequestHandler" />
<dataDir>${solr.data.dir:./data/clientes}</dataDir>
</config>
2010年2月5日10:07:11 org.apache.solr.common.SolrException日志
GRAVE:org.apache.solr.common.SolrException:未定义字段null
位于org.apache.solr.schema.IndexSchema.getDynamicFieldType(IndexSchema.java:1136)
位于org.apache.solr.schema.IndexSchema.getFieldType(IndexSchema.java:1098)
在org.apache.solr.search.SolrQueryParser.getWildcardQuery(SolrQueryParser.java:193)
位于org.apache.lucene.queryParser.queryParser.Term(queryParser.java:1434)
位于org.apache.lucene.queryParser.queryParser.子句(queryParser.java:1337)
位于org.apache.lucene.queryParser.queryParser.Query(queryParser.java:1265)
位于org.apache.lucene.queryParser.queryParser.TopLevelQuery(queryParser.java:1254)
位于org.apache.lucene.queryParser.queryParser.parse(queryParser.java:200)
位于org.apache.solr.search.LuceneQParser.parse(LuceneQParserPlugin.java:78)
位于org.apache.solr.search.QParser.getQuery(QParser.java:131)
位于org.apache.solr.handler.component.QueryComponent.prepare(QueryComponent.java:89)
位于org.apache.solr.handler.component.SearchHandler.HandlerRequestBody(SearchHandler.java:174)
位于org.apache.solr.handler.RequestHandlerBase.HandlerRequest(RequestHandlerBase.java:131)
位于org.apache.solr.core.SolrCore.execute(SolrCore.java:1316)
在org.apache.solr.client.solrj.embedded.EmbeddedSolrServer.request(EmbeddedSolrServer.java:139)上
位于org.apache.solr.client.solrj.request.QueryRequest.process(QueryRequest.java:89)
位于org.apache.solr.client.solrj.SolrServer.query(SolrServer.java:118)
位于paqueteBase.PruebaDeSolr.ejecutate(PruebaDeSolr.java:67)
在paqueteBase.PruebaDeSolr.main(PruebaDeSolr.java:24)好的,似乎我需要在schema.xml中将字段“nombre”指定为uniqueKey和defaultSearchField。它开始工作。在q参数中有一个错误的查询字符串,应该是*:*而不仅仅是*。您得到该异常是因为SOLR正在尝试解析目标字段的名称,首先尝试使用声明的字段,然后查找动态字段定义。Hi。。您得到的异常是什么?查询应该是“:”而不是“*”,但我认为这不是导致异常的原因。。。您可以发布schema.xml吗?