SolrException: undefined field type

1,621 views
Skip to first unread message

Caleb Brown

unread,
Sep 20, 2011, 11:20:30 AM9/20/11
to ruby-s...@googlegroups.com
I'm having problems deploying a rails 3.1 app with sunspot (1.2.1) to my server.  I've used sunspot several times on other projects and never had any issues.  This is the first time I've used it with Rails 3.1 and it is a new server.

I can access my solr install at localhost:8081/solr and I've copied the conf dir into RailsRoot/solr/conf as usual, but I'm still getting the exception below when trying to reindex (stop and start work just fine).  I've even limited my model to just index 1 field.  Does anyone see anything obvious or has anyone encountered any similar issue?  Thanks for any help!

tomcat exception:

INFO: {} 0 0
Sep 20, 2011 11:07:50 AM org.apache.solr.common.SolrException log
SEVERE: org.apache.solr.common.SolrException: undefined field type
at org.apache.solr.schema.IndexSchema.getDynamicFieldType(IndexSchema.java:1136)
at org.apache.solr.schema.IndexSchema$SolrQueryAnalyzer.getAnalyzer(IndexSchema.java:389)
at org.apache.solr.schema.IndexSchema$SolrIndexAnalyzer.reusableTokenStream(IndexSchema.java:364)
at org.apache.lucene.queryParser.QueryParser.getFieldQuery(QueryParser.java:567)
at org.apache.solr.search.SolrQueryParser.getFieldQuery(SolrQueryParser.java:153)
at org.apache.lucene.queryParser.QueryParser.Term(QueryParser.java:1449)
at org.apache.lucene.queryParser.QueryParser.Clause(QueryParser.java:1337)
at org.apache.lucene.queryParser.QueryParser.Query(QueryParser.java:1265)
at org.apache.lucene.queryParser.QueryParser.TopLevelQuery(QueryParser.java:1254)
at org.apache.lucene.queryParser.QueryParser.parse(QueryParser.java:200)
at org.apache.solr.search.QueryParsing.parseQuery(QueryParsing.java:73)
at org.apache.solr.search.QueryParsing.parseQuery(QueryParsing.java:62)
at org.apache.solr.update.DirectUpdateHandler2.deleteByQuery(DirectUpdateHandler2.java:317)
at org.apache.solr.update.processor.RunUpdateProcessor.processDelete(RunUpdateProcessorFactory.java:71)
at org.apache.solr.handler.XMLLoader.processDelete(XMLLoader.java:234)
at org.apache.solr.handler.XMLLoader.processUpdate(XMLLoader.java:180)
at org.apache.solr.handler.XMLLoader.load(XMLLoader.java:69)
at org.apache.solr.handler.ContentStreamHandlerBase.handleRequestBody(ContentStreamHandlerBase.java:54)
at org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:131)
at org.apache.solr.core.SolrCore.execute(SolrCore.java:1317)
at org.apache.solr.servlet.SolrDispatchFilter.execute(SolrDispatchFilter.java:338)
at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:241)
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:298)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Thread.java:679)

Sep 20, 2011 11:07:50 AM org.apache.solr.core.SolrCore execute
INFO: [] webapp=/solr path=/update params={wt=ruby} status=400 QTime=0

sunspot.yml

  solr:
    hostname: localhost
    port: 8081
    log_level: WARNING
    path: '/solr'

model
searchable do
  text :title, :stored => true, :boost => 2
end

task exception:

Execute sunspot:reindex
rake aborted!
Solr Response: Bad Request
/usr/local/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
Tasks: TOP => sunspot:reindex

Caleb Brown

unread,
Sep 20, 2011, 1:37:32 PM9/20/11
to ruby-s...@googlegroups.com

Caleb Brown

unread,
Sep 21, 2011, 2:23:58 PM9/21/11
to ruby-s...@googlegroups.com
I abandoned my efforts to use solr and went to thinking_sphinx. Too bad though, I have to hit the db now.

Matthew A. Brown

unread,
Sep 21, 2011, 2:31:37 PM9/21/11
to ruby-s...@googlegroups.com
Hi Caleb,

In that case, I'm sure your deployment woes are all behind you : )

The reason you were seeing that error is that your Solr instance was
not configured with Sunspot's schema. I'm not sure about that wiki
page but basically you need to make sure that schema.xml and
solrconfig.xml in your Solr installation are the ones that ship with
Sunspot. This needs to be done by hand in production (the configs in
your Rails app directory are only used by the bundled Solr instance
intended for development/testing use).

Mat

On Wed, Sep 21, 2011 at 14:23, Caleb Brown <killerdi...@gmail.com> wrote:
> I abandoned my efforts to use solr and went to thinking_sphinx. Too bad
> though, I have to hit the db now.
>

> --
> You received this message because you are subscribed to the Google Groups
> "Sunspot" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/ruby-sunspot/-/mWCrEba73gsJ.
> To post to this group, send email to ruby-s...@googlegroups.com.
> To unsubscribe from this group, send email to
> ruby-sunspot...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/ruby-sunspot?hl=en.
>

Warren Prince

unread,
Sep 21, 2011, 2:57:56 PM9/21/11
to ruby-s...@googlegroups.com
Funny, I went the other way. Started out with thinking_sphinx and found that they use the word "search" as a keyword and no way to avoid it. We have a large, mature application where we've used "search" in the past in too many lines of code to think about. I was really surprised they would use such a common word and offer no way to protect existing code.

Caleb Brown

unread,
Sep 21, 2011, 3:05:41 PM9/21/11
to ruby-s...@googlegroups.com
Thanks for getting back to me.

Yea, I tried doing that (even though I've never had to do that in the past), but to no avail.  I would recommend moving that step up on the wiki. It didn't seem like a necessary step since the headline was something about a two step install.  In the past, all I had to do was install tomcat6 and tomcat-common to get it all working correctly.  I assume something updated in the gem that changed that though, but unfortunately wasn't pay close enough attention to see where that's happening.

At any rate, I was tired of installing/uninstalling solr-tomcat, so I gave up.  I'll try again when I've got more time since I much prefer sunspot/solr over other search engines.

Matthew A. Brown

unread,
Sep 21, 2011, 3:16:52 PM9/21/11
to ruby-s...@googlegroups.com
Hi Caleb,

Not sure about your previous experience but Sunspot has required its
schema to be installed since the first release. Hope you're able to
get it working when you have time.

Mat

> --
> You received this message because you are subscribed to the Google Groups
> "Sunspot" group.
> To view this discussion on the web visit

> https://groups.google.com/d/msg/ruby-sunspot/-/CJyQSr8hzOQJ.

Nick Zadrozny

unread,
Sep 21, 2011, 3:35:17 PM9/21/11
to ruby-s...@googlegroups.com
On Wed, Sep 21, 2011 at 12:05 PM, Caleb Brown <killerdi...@gmail.com> wrote:
At any rate, I was tired of installing/uninstalling solr-tomcat, so I gave up.  I'll try again when I've got more time since I much prefer sunspot/solr over other search engines.

Any interest in a hosted setup? I got fed up with setting up Solr a few years ago and decided to solve it once and for all with http://websolr.com/. Drop me a line and I'll hook you up with a free trial — I'm always keen to hear feedback from fellow Sunspot users.

--
Nick Zadrozny

http://websolr.com — hassle-free hosted search, powered by Apache Solr

Reply all
Reply to author
Forward
0 new messages