solr undefined field text 异常

org.apache.solr.common.SolrException: undefined field text
    at org.apache.solr.schema.IndexSchema.getDynamicFieldType(IndexSchema.java:1241)
    at org.apache.solr.schema.IndexSchema$SolrQueryAnalyzer.getWrappedAnalyzer(IndexSchema.java:419)
    at org.apache.lucene.analysis.AnalyzerWrapper.initReader(AnalyzerWrapper.java:117)
    at org.apache.lucene.analysis.Analyzer.tokenStream(Analyzer.java:178)
    at org.apache.lucene.util.QueryBuilder.createFieldQuery(QueryBuilder.java:207)
    at org.apache.solr.parser.SolrQueryParserBase.newFieldQuery(SolrQueryParserBase.java:375)
    at org.apache.solr.parser.SolrQueryParserBase.getFieldQuery(SolrQueryParserBase.java:743)
    at org.apache.solr.parser.SolrQueryParserBase.handleBareTokenQuery(SolrQueryParserBase.java:542)
    at org.apache.solr.parser.QueryParser.Term(QueryParser.java:299)
    at org.apache.solr.parser.QueryParser.Clause(QueryParser.java:185)
    at org.apache.solr.parser.QueryParser.Query(QueryParser.java:107)
    at org.apache.solr.parser.QueryParser.TopLevelQuery(QueryParser.java:96)
    at org.apache.solr.parser.SolrQueryParserBase.parse(SolrQueryParserBase.java:152)
    at org.apache.solr.search.LuceneQParser.parse(LuceneQParser.java:50)
    at org.apache.solr.search.QParser.getQuery(QParser.java:141)
    at org.apache.solr.handler.component.QueryComponent.prepare(QueryComponent.java:145)
    at org.apache.solr.handler.component.SearchHandler.handleRequestBody(SearchHandler.java:196)
    at org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:135)
    at org.apache.solr.core.SolrCore.execute(SolrCore.java:1916)
    at org.apache.solr.core.QuerySenderListener.newSearcher(QuerySenderListener.java:64)
    at org.apache.solr.core.SolrCore$5.call(SolrCore.java:1695)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
    at java.util.concurrent.FutureTask.run(FutureTask.java:138)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:662)
 
根据提示明显是有个名称为text的field未定义, 可是schem.xml中未找到。最后定为为可能是solr其他的配置中引用了text  ,重点怀疑solrconfig.xml ,最后发现以下一段
<str name="df">text</str>    df为solr中默认的搜索field   , 那么此处定义了默认field为text,可是我的schema.xml中未定义text,那么肯定会报以上错误。
解决方法:1.在schema.xml中定义一个字段
		<field name="text" type="text_general" indexed="true" stored="false" multiValued="true"/>
		 2.在solrconfig.xml中的所有df中更改为schema.xml中存在的字段,如 id
posted @ 2017-02-06 14:58  逆流的鱼_飞  阅读(4829)  评论(0编辑  收藏  举报