Не удается добавить в индекс Solr - в документе отсутствует поле uniqueKey? - PullRequest
1 голос
/ 12 августа 2011

Я использую SolrNET для управления моим индексом Solr.После того как я обновил схему новым полем uniqueKey под названием «guid», я не могу добавить документы в Solr.

Это ошибка журнала Tomcat:

org.apache.solr.common.SolrException: в документе отсутствует идентификатор поля уникального ключа

Я добавляю объект, подобный этому, в 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)
            };

Странная вещь, это прекрасно работает, когдалокальное тестирование, однако, вообще не работает в реальном времени.

Вот как выглядит schema.config:

<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" /> 

Чего мне не хватает?

1 Ответ

0 голосов
/ 12 августа 2011

Хорошо, это немного стыдно. Мой сайт вызывает веб-сервис, который выполняет фактическую индексацию. Я скопировал основной dll проекта веб-службы в папку живого сервера, но не одну из вспомогательных библиотек с обновленным полем схемы.

...