Your schema has only "fields", but no field "types". Check the Solr example schema for reference, and include all of the types defined there unless you know that you do not need them. "string" is clearly one that is needed.

-- Jack Krupansky

-----Original Message----- From: Patrice Seyed
Sent: Monday, March 25, 2013 7:19 PM
To: solr-user@lucene.apache.org
Subject: Re: status 400 on posting json

Hi Jack, I tried putting the schema.xml file (further below) in the
path you specified below, but when i tried to start (java -jar
start.jar) got the message below.

I can try a fresh install like you suggested, but I'm not sure what
would be different. I was using documenationt at
http://lucene.apache.org/solr/4_1_0/tutorial.html using the binary
from zip. Are you suggesting building from source and/or some other
approach? Also, what is the best documentation currently for 4.1
install (for mac), (there are a lot of sites out there.) Thanks in
advance. -Patrice

SEVERE: Unable to create core: collection1
org.apache.solr.common.SolrException: Unknown fieldtype 'string'
specified on field id
at org.apache.solr.schema.IndexSchema.readSchema(IndexSchema.java:390)
at org.apache.solr.schema.IndexSchema.<init>(IndexSchema.java:113)
at org.apache.solr.core.CoreContainer.createFromLocal(CoreContainer.java:1000)
at org.apache.solr.core.CoreContainer.create(CoreContainer.java:1033)
at org.apache.solr.core.CoreContainer$3.call(CoreContainer.java:629)
at org.apache.solr.core.CoreContainer$3.call(CoreContainer.java:624)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:439)
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:895) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
at java.lang.Thread.run(Thread.java:680)
Mar 25, 2013 7:14:53 PM org.apache.solr.common.SolrException log
SEVERE: null:org.apache.solr.common.SolrException: Unable to create
core: collection1
at org.apache.solr.core.CoreContainer.recordAndThrow(CoreContainer.java:1654)
at org.apache.solr.core.CoreContainer.create(CoreContainer.java:1039)
at org.apache.solr.core.CoreContainer$3.call(CoreContainer.java:629)
at org.apache.solr.core.CoreContainer$3.call(CoreContainer.java:624)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:439)
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:895) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
at java.lang.Thread.run(Thread.java:680)
Caused by: org.apache.solr.common.SolrException: Unknown fieldtype
'string' specified on field id
at org.apache.solr.schema.IndexSchema.readSchema(IndexSchema.java:390)
at org.apache.solr.schema.IndexSchema.<init>(IndexSchema.java:113)
at org.apache.solr.core.CoreContainer.createFromLocal(CoreContainer.java:1000)
at org.apache.solr.core.CoreContainer.create(CoreContainer.java:1033)
... 10 more


---

Here's the normal path to the example configuration in Solr 4.1:

.../solr-4.1.0/example/solr/collection1/conf

That's the directory in which the example schema.xml and other
configuration files live.

There is no solr-4.1.0/example/conf directory, unless you managed to
create one yourself.

I suggest that you start with a fresh install of Solr 4.1

As far as keywords, the existing field is set up to be a
comma-separated list of keyword phrases. Of course, you can structure
it any way that your application requires.

-- Jack Krupansky

-----Original Message----- From: Patrice Seyed
Sent: Saturday, March 16, 2013 2:48 AM
To: solr-user@lucene.apache.org
Subject: Re: status 400 on posting json

Hi,

Re:

-----------------
Is there some place I should indicate what parameters are including in
the json objects send? I was able to test books.json without the
error.

"Yes, in Solr's schema.xml (under the conf/ directory).  See
<http://wiki.apache.org/solr/SchemaXml> for more details.

      Erik Hatcher"

and:

-----------------

"I tried it and I get the same error response! Which is because... I
don't have a field named "datasource".

You need to check the Solr schema.xml for the available fields and
then add any fields that your JSON uses that are not already there. Be
sure to shutdown and restart Solr after editing the schema.

I did notice that there is a "keywords" field, but it is not
multivalued, while you keywords are multivalued.

Or, you can us dynamic fields, such as "datasource_s" and "keywords_ss
("s" for string and a second "s" for multivalued), etc. for your other
fields.

-- Jack Krupansky"

-----------------

Thanks very much for these responses.  I'm still confused by the fact
that there is no schema.xml for the books.json fields though. Was this
compiled into the start.jar? Also, where do I place my crafted
schema.xml? I tried in ~/solr-4.1.0/example/conf where the start.jar
is in/run from ~/solr-4.1.0/example but so far is still complaining
about not finding the 'datasource' field. (also tried placing it in
~/solr-4.1.0/example/solr/conf) (my current schema.xml is further
below.)

Also Jack, would it be better to parse this keywords field value
differently for it to be appropriately multivalued?:

"keywords":["EARTH SCIENCE
: Oceans : Ocean Temperature : Water
Temperature","Temperature","Integrated Ocean Observing
System","IOOS","Oceanographic Sensor Data","Intertidal Temperature
Data","continental shelf","seawater","temperature","Oregon","United
States of America","PISCO"]

Thanks,
Patrice


<?xml version="1.0" encoding="UTF-8" ?>
<schema name="example" version="1.5">
<fields>
 <field name="id" type="string" indexed="true" stored="true"
required="true" multiValued="false" />
 <field name="datasource" type="string" indexed="true" stored="true"
required="true" multiValued="false" />
 <field name="abstract" type="string" indexed="true" stored="true"
required="true" multiValued="false" />
 <field name="title" type="string" indexed="true" stored="true"
required="true" multiValued="false" />
 <field name="author" type="string" indexed="true" stored="true"
required="true" multiValued="false" />
 <field name="contactOrganization" type="string" indexed="true"
stored="true" required="true" multiValued="false" />
 <field name="keywords" type="string" indexed="true" stored="true"
required="true" multiValued="false" />
</fields>
</schema>

Reply via email to