views:

224

answers:

1

I'm adding a few fields using solrj. What changes need i make in the solrconfig.xml and schema.xml?

I'm new to solr and i'd love some help

+1  A: 

You shouldn't need to change solrconfig.xml unless you are changing the way your solr instance behaves. Adding a field just requires that schema.xml include a line like:

<field name="myField" type="[field of a type defined in your schema]" indexed="true|false"  stored="true|false"  multiValued="true|false" /> 
andyashton
I did that and I got an error - Unknown field.Should I change any requestHandlers?The code:SolrInputDocument doc = new SolrInputDocument(); String docID = "1112211111"; doc.addField( "id", docID, 1.0f ); doc.addField( "name", "ESFDF", 1.0f ); UpdateResponse upres = server.add( doc );
ryan
If you're getting an "Unknown field" then it is most likely that your incoming XML has a field that has not been declared in your schema. Can you show us the <field> elements for your id and name fields?
andyashton