我已经安装了solr 4.9.1。 这是我的schema.xml
<?xml version="1.0" encoding="UTF-8" ?>
<schema name="ayan_schema" version="1.5">
<types>
<fieldType name="string" class="solr.StrField" />
<fieldType name="long" class="solr.TrieLongField"
precisionStep="0" positionIncrementGap="0" />
<fieldType name="text" class="solr.TextField">
<analyzer>
<tokenizer class="solr.StandardTokenizerFactory" />
</analyzer>
</fieldType>
<fieldtype name="syn" class="solr.TextField">
<analyzer>
<tokenizer class="solr.WhitespaceTokenizerFactory" />
<filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt"
ignoreCase="true" expand="false" />
</analyzer>
</fieldtype>
</types>
<fields>
<field name="_version_" type="long" indexed="true" stored="true" />
<field name="id" type="string" indexed="true" stored="true" />
<field name="name" type="string" indexed="true" stored="true" />
<field name="email" type="string" indexed="true" stored="true" />
<field name="skype" type="string" indexed="true" stored="true" />
<field name="irc" type="string" indexed="true" stored="true" />
<field name="twitter" type="string" indexed="true" stored="true" />
<field name="syn_val" type="syn" indexed="true" stored="true" />
<field name="all" type="string" docValues="true" indexed="true"
stored="true" multiValued="true" />
</fields>
<defaultSearchField>name</defaultSearchField>
<uniqueKey>id</uniqueKey>
<copyField source="id" dest="all" />
<copyField source="email" dest="all" />
<copyField source="skype" dest="all" />
<copyField source="irc" dest="all" />
<copyField source="twitter" dest="all" />
</schema>
当我使用name字段搜索时,我得到以下异常:
org.apache.solr.common.SolrException: undefined field text
at org.apache.solr.schema.IndexSchema.getDynamicFieldType(IndexSchema.java:1267)
at org.apache.solr.schema.IndexSchema$SolrQueryAnalyzer.getWrappedAnalyzer(IndexSchema.java:433)
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:148)
at org.apache.solr.handler.component.SearchHandler.handleRequestBody(SearchHandler.java:197)
at org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:135)
at org.apache.solr.core.SolrCore.execute(SolrCore.java:1962)
at org.apache.solr.core.QuerySenderListener.newSearcher(QuerySenderListener.java:64)
at org.apache.solr.core.SolrCore$5.call(SolrCore.java:1734)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
我无法弄清楚我正在做的错误。当我使用除名称以外的任何字段进行搜索时,我能够正确搜索。 查询是:
http://localhost:8983/solr/collection1/select?q=name%3Adennis+l*&fl=*%2Cscore&wt=json&indent=true
答案 0 :(得分:5)
错误消息显示“未定义的字段文本”。这意味着正在对名为text的字段执行搜索。您可以在此处粘贴查询参数,以查看请求参数是什么以及导致此问题的原因。
答案 1 :(得分:1)
修改您的查询并添加其他参数 debugQuery = true
通过这种方式,您将在响应的专用部分中看到Solr我如何解释您的查询以及您想要做什么与Solr实际做什么之间的误解