Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Solr Query - HTTP error 404 undefined field text

Tags:

I've got a Solr instance running on my Ubuntu machine using the default Jetty server that the Solr download comes with. Whenever I start Solr using

java -jar start.jar

The server starts fine but there is always an exception thrown:

INFO: SolrDispatchFilter.init() done Apr 12, 2012 2:01:56 PM org.apache.solr.common.SolrException log SEVERE: org.apache.solr.common.SolrException: undefined field text 

As I said though, the server will still start and I can see the Solr admin interface. I defined my schema as follows.

<fields>     <field name="id" type="string" indexed="true" stored="true" />     <field name="phraseID" type="int" indexed="true" stored="true" />     <field name="translation" type="string" indexed="true" stored="true" /> </fields> <uniqueKey>id</uniqueKey> 

I was also able to perform a JSON update - I submitted a sample array of data that was accepted. Up to this point everything is fine.

When I attempt to run a query:

http://localhost:8983/solr/select/?q=*:*&version=2.2&start=0&rows=10&indent=on 

It correctly returns all the data that I submitted in my sample earlier.

However, the moment I try to query using text, I receive an HTTP ERROR 404.

http://localhost:8983/solr/select/?q=fruit&version=2.2&start=0&rows=10&indent=on  --- returns ---  HTTP ERROR 400  Problem accessing /solr/select/. Reason:      undefined field text Powered by Jetty:// 
like image 430
Jarrod Nettles Avatar asked Apr 12 '12 19:04

Jarrod Nettles


2 Answers

I had the same problem. In case there is no <defaultSearchField> in the solrconfig.xml file, look for the /select handler.

Within that you would find something like this

<str name="df">text</str> 

That is the culprit. df means the default field and it, by default, and agreeably, quite stupidly, is set to a field called text which many might not have.

Remove it and replace it with whatever is to be your default search field.

like image 185
Arindam Avatar answered Sep 28 '22 02:09

Arindam


Default solr configuration has defined some request handlers with defaults that match the default schema included in the solr tarball.

Check the request handlers defined in solrconfig and you might find that <str name="qf"> and other configuration values include some fields you haven't defined in the schema.

Also, check your schema.xml, that the default search field isn't set to text like this: <defaultSearchField>text</defaultSearchField>

like image 35
hovenko Avatar answered Sep 28 '22 01:09

hovenko