Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Solr "Undefined field text"

Tags:

java

solr

tomcat

I've recently upgraded my solr instance from 1,4 to 3.6. However, I now appear to be getting an "undefined field text" severe message in my logs whenever I update my index.

I do have text fields in my schema (which was valid as of version 1.4), but never previously had to be declared as a field type. Has this changed in 3.6?

My schema is here >> http://pastebin.com/KrCVab0U

SEVERE: org.apache.solr.common.SolrException: undefined field text
        at org.apache.solr.schema.IndexSchema.getDynamicFieldType(IndexSchema.java:1330)
        at org.apache.solr.schema.IndexSchema$SolrQueryAnalyzer.getAnalyzer(IndexSchema.java:408)
        at org.apache.solr.schema.IndexSchema$SolrIndexAnalyzer.reusableTokenStream(IndexSchema.java:383)
        at org.apache.lucene.queryParser.QueryParser.getFieldQuery(QueryParser.java:574)
        at org.apache.solr.search.SolrQueryParser.getFieldQuery(SolrQueryParser.java:206)
        at org.apache.lucene.queryParser.QueryParser.Term(QueryParser.java:1429)
        at org.apache.lucene.queryParser.QueryParser.Clause(QueryParser.java:1317)
        at org.apache.lucene.queryParser.QueryParser.Query(QueryParser.java:1245)
        at org.apache.lucene.queryParser.QueryParser.TopLevelQuery(QueryParser.java:1234)
        at org.apache.lucene.queryParser.QueryParser.parse(QueryParser.java:206)
        at org.apache.solr.search.LuceneQParser.parse(LuceneQParserPlugin.java:79)
        at org.apache.solr.search.QParser.getQuery(QParser.java:143)
        at org.apache.solr.handler.component.QueryComponent.prepare(QueryComponent.java:105)
        at org.apache.solr.handler.component.SearchHandler.handleRequestBody(SearchHandler.java:165)
        at org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:129)
        at org.apache.solr.core.SolrCore.execute(SolrCore.java:1376)
        at org.apache.solr.handler.PingRequestHandler.handleRequestBody(PingRequestHandler.java:67)
        at org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:129)
        at org.apache.solr.core.SolrCore.execute(SolrCore.java:1376)
        at org.apache.solr.servlet.SolrDispatchFilter.execute(SolrDispatchFilter.java:365)
        at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:260)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
        at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:602)
        at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
        at java.lang.Thread.run(Thread.java:679)
like image 413
Lee Davis Avatar asked Jul 03 '12 10:07

Lee Davis


4 Answers

It is not about field type "text". It is about field named "text".

You've changed the default field in config to "search_text". Please try renaming all references to "search_text" to "text". If this fixes the issue, then you know somewhere in the configuration you're referring to "text" field, possibly in solrconfig.xml as suggested in Solr Query - HTTP error 404 undefined field text

Hope it helps.

like image 195
krishnakumarp Avatar answered Oct 09 '22 11:10

krishnakumarp


i have this in my solrconfig.xml file.

<requestHandler name="/admin/ping" class="solr.PingRequestHandler">
 <lst name="invariants">
  <str name="q">solrpingquery</str>
 </lst>
 <lst name="defaults">      
  <str name="echoParams">all</str>
  </lst>
</requestHandler>

If you haven't added this in schema.xml then add it

<field name="text" type="text_general" indexed="true" stored="false" multiValued="true"/>

This will solve your problem.

Thanks

like image 44
Ghulam Rasool Avatar answered Oct 09 '22 11:10

Ghulam Rasool


It just happened too me today. If your doing a query when the error occurs then you need to double quoted the data in the query like this:

filepath:"data to be queried"

like image 3
Bob Avatar answered Oct 09 '22 10:10

Bob


I got the same error when I sanitized the fq part of the query. After sanitizing, the solr received

...&fq=type\:Product&...

Although I have field named type, the error was saying “Undefined field text”.

When I removed the sanitization, the query was ok then:

...&fq=type:Product&...

The cause of the confusing error message was in solrconfig.xml:

<requestHandler name="/select" class="solr.SearchHandler">
  <lst name="defaults">
    <str name="echoParams">explicit</str>
    <int name="rows">10</int>
    <str name="df">text</str>
  </lst>
</requestHandler>
like image 2
mirelon Avatar answered Oct 09 '22 10:10

mirelon