1
votes

I'm using SolrNET to manage my Solr index. After I updated the schema with a new uniqueKey field called "guid", I can't add documents to Solr.

This is the Tomcat log error:

org.apache.solr.common.SolrException: Document is missing uniqueKey field guid

I'm adding an object like this to Solr:

return new T()
            {
                GUID = Guid.NewGuid().ToString(),
                Id = reader.GetInt32(0),                
                Heading = reader.GetString(1),
                Body = freeText,
                ForumRoom = reader.GetInt32(3),
                ForumTopicId = reader.GetInt32(9),
                SearchObjectType = reader.GetBoolean(5) ? SearchBase.ObjectType.ForumReply.ToString() : SearchBase.ObjectType.ForumTopic.ToString(),
                Date = reader.GetDateTime(6)
            };

The strange thing, this works perfectly well when testing local, however doesn't work at all live.

This is what the schema.config looks like:

<fields>
      <field name="id" type="int" indexed="true" stored="true" required="true" />
      <field name="searchobjecttype" type="string" indexed="true" stored="true" required="true" />
      <field name="heading" type="text" indexed="true" stored="false" required="false" />
      <field name="body" type="text" indexed="true" stored="false" required="false" />
      <field name="locationid" type="int" indexed="true" stored="true" required="false" />
      <field name="currentlocationid" type="int" indexed="true" stored="true" required="false" />
      <field name="countryid" type="int" indexed="true" stored="true" required="false" />
      <field name="currentcountryid" type="int" indexed="true" stored="true" required="false" />
      <field name="forumroom" type="int" indexed="true" stored="true" required="false" />
        <field name="forumtopicid" type="int" indexed="true" stored="true" required="false" />
      <field name="dt" type="date" indexed="true" stored="false" required="false" />
      <field name="txt" type="text" indexed="true" stored="true" multiValued="true" />
      <field name="guid" type="string" indexed="true" stored="true" required="false" />
  </fields>
      <copyField source="id" dest="txt" />
      <copyField source="searchobjecttype" dest="txt" />
      <copyField source="heading" dest="txt" />
      <copyField source="body" dest="txt" />
      <copyField source="locationid" dest="txt" />
      <copyField source="currentlocationid" dest="txt" />
      <copyField source="countryid" dest="txt" />
      <copyField source="currentcountryid" dest="txt" />
      <copyField source="forumroom" dest="txt" />
      <copyField source="forumtopicid" dest="txt" />
      <copyField source="dt" dest="txt" />
      <uniqueKey>guid</uniqueKey>
      <defaultSearchField>txt</defaultSearchField>
      <solrQueryParser defaultOperator="AND" /> 

What am I missing?

1

1 Answers

0
votes

Ok, this is a bit embarassing. My website calls a web service that does the actual indexing. I had copied the main web service project dll to the live server folder, but not one of the helper libraries with the updated schema field..