1

solr の新しいローカル インストールに行き詰まっています。ある時点まで、すべてが正常に機能します。

問題なくsolrの管理者にアクセスできます:http://localhost:8983/solr/admin/

しかし、mysql コンテンツのインデックスを作成すると、次のエラーがスローされます。

更新リクエストが失敗しました。応答コード 0。 (ヌル)

何もありません。私はどこでも少し見ましたが、何がどこに問題があるのか​​ 本当にわかりません。

何か案が ?

インデックスを作成しようとするものに関する情報を次に示します。

私の schema.xml のフィールド:

<field name="pl_album_id" type="string" indexed="true" stored="true" required="true" />
   <field name="pl_album_num_id" type="int" indexed="true" stored="true" required="true" />
   <field name="pl_album_title" type="text_general_fr" indexed="true" stored="true"/>
   <field name="pl_album_number" type="int" indexed="true" stored="true"/>
   <field name="pl_album_keywords" type="text_general_fr" indexed="true" stored="true"/>
   <field name="pl_album_summary" type="text_general_fr" indexed="true" stored="true"/>
   <field name="pl_album_general_mark" type="int" indexed="true" stored="true"/>
   <field name="pl_album_authors" type="text_general_fr" indexed="true" stored="true"/>
   <field name="pl_album_signer_id" type="int" indexed="true" stored="true" multiValued="true"/>
   <field name="pl_album_format" type="text_general_fr" indexed="true" stored="true"/>
   <field name="pl_album_is_complete" type="int" indexed="true" stored="true"/>
   <field name="pl_album_status_id" type="int" indexed="true" stored="true"/>
   <field name="pl_album_sort_status_id" type="int" indexed="true" stored="true"/>
   <field name="pl_album_is_online" type="int" indexed="true" stored="true"/>
   <field name="pl_album_review_created_at" type="date" indexed="true" stored="true"/>
   <field name="pl_album_review_year" type="int" indexed="true" stored="true"/>
   <field name="pl_series_id" type="int" indexed="true" stored="true"/>
   <field name="pl_series_title" type="text_general_fr" indexed="true" stored="true"/>
   <field name="pl_series_title_copy_for_sorting" type="string" indexed="true" stored="true"/>
   <field name="pl_series_prefix" type="text_general_fr" indexed="true" stored="true"/>
   <field name="pl_series_type_id" type="int" indexed="true" stored="true"/>
   <field name="pl_series_origin_id" type="int" indexed="true" stored="true"/>
   <field name="pl_series_genre_id" type="int" indexed="true" stored="true" multiValued="true"/>
   <field name="pl_series_genres" type="text_general_fr" indexed="true" stored="true"/>
   <field name="pl_series_targeted_public_id" type="int" indexed="true" stored="true" multiValued="true"/>
   <field name="pl_collection_id" type="int" indexed="true" stored="true"/>
   <field name="pl_collection_label" type="text_general_fr" indexed="true" stored="true"/>
   <field name="pl_publisher_id" type="int" indexed="true" stored="true"/>
   <field name="pl_publisher_name" type="text_general_fr" indexed="true" stored="true"/>
   <field name="pl_published_at" type="date" indexed="true" stored="true"/>
   <field name="pl_visit_counter" type="int" indexed="true" stored="true"/>
   <field name="pl_user_id" type="int" indexed="true" stored="true"/>
   <field name="pl_user_first_name" type="text_general_fr" indexed="true" stored="true"/>
   <field name="pl_user_last_name" type="text_general_fr" indexed="true" stored="true"/>
   <field name="pl_cycle_type_id" type="int" indexed="true" stored="true"/>
   <field name="pl_cycle_title" type="text_general_fr" indexed="true" stored="true"/>
   <field name="pl_cycle_number" type="int" indexed="true" stored="true"/>

そして、私はその関数でそれらにインデックスを付けます:

public function solrIndex($AlbumId = null)
    {
      $album = new Album();
      $album_list = $album->getForSolrIndex($AlbumId);

      $options = array
      (
          'hostname' => sfConfig::get('plconfig_solr_hostname'),
          'port'     => sfConfig::get('plconfig_solr_port')
      );
      $solr_client = new SolrClient($options);

      foreach($album_list as $album_details)
      {
        $solr_client->deleteByQuery("pl_album_num_id:".$album_details['id']);
      }
      $solr_client->commit();

      foreach($album_list as $album_details)
      {
        $doc = new SolrInputDocument();

        $doc->addField('pl_album_id', $album_details['id']);
        $doc->addField('pl_album_num_id', $album_details['id']);
        $doc->addField('pl_album_title', $album_details['title']);
        if($album_details['number'])
        {
          $doc->addField('pl_album_number', $album_details['number']);
        }
        $doc->addField('pl_album_keywords', $album_details['keywords']);
        $doc->addField('pl_album_summary', $album_details['summary']);
        if($album_details['general_mark'])
        {
          $doc->addField('pl_album_general_mark', $album_details['general_mark']);
        }
        $doc->addField('pl_album_authors', $album_details['authors']);
        $doc->addField('pl_album_is_complete', $album_details['album_is_complete'] ? $album_details['album_is_complete'] : 0);
        $doc->addField('pl_album_status_id', $album_details['status_id'] ? $album_details['status_id'] : 0);
        $sort_status_id = 8;
        if($album_details['status_id'] == Album::TO_REREAD)
        {
          $sort_status_id = 1;
        }
        if($album_details['status_id'] == Album::TO_IMPROVE)
        {
          $sort_status_id = 2;
        }
        if($album_details['status_id'] == Album::TO_REVIEW)
        {
          $sort_status_id = 3;
        }
        if($album_details['status_id'] == Album::TO_RECEIVE)
        {
          $sort_status_id = 4;
        }
        if($album_details['status_id'] == Album::ONLINE)
        {
          $sort_status_id = 5;
        }
        if($album_details['status_id'] == Album::ABANDON_BY_PUBLISHER)
        {
          $sort_status_id = 6;
        }
        if($album_details['status_id'] == Album::ABANDON_BY_PLANETEBD)
        {
          $sort_status_id = 7;
        }
        $doc->addField('pl_album_sort_status_id', $sort_status_id);
        $doc->addField('pl_album_format', $album_details['format']);
        $doc->addField('pl_album_is_online', $album_details['is_online'] ? $album_details['is_online'] : 0);
        if($album_details['album_review_created_at'])
        {
          $doc->addField('pl_album_review_created_at', date('Y-m-d\TH:i:s\Z', strtotime($album_details['album_review_created_at'])));
          $doc->addField('pl_album_review_year', date('Y', strtotime($album_details['album_review_created_at'])));
        }
        $doc->addField('pl_series_id', $album_details['series_id']);
        $doc->addField('pl_series_title', $album_details['series_title']);
        $doc->addField('pl_series_title_copy_for_sorting', $album_details['series_title']);
        $doc->addField('pl_series_prefix', $album_details['series_prefix']);
        if($album_details['type_id'])
        {
          $doc->addField('pl_series_type_id', $album_details['type_id']);
        }
        $doc->addField('pl_series_genres', $album_details['series_genres']);
        $doc->addField('pl_series_origin_id', $album_details['series_origin_id'] ? $album_details['series_origin_id'] : 0);
        $doc->addField('pl_collection_id', $album_details['collection_id'] ? $album_details['collection_id'] : 0);
        $doc->addField('pl_collection_label', $album_details['label']);
        $doc->addField('pl_publisher_id', $album_details['publisher_id']);
        $doc->addField('pl_publisher_name', $album_details['name']);
        if($album_details['published_at'])
        {
          $doc->addField('pl_published_at', $album_details['published_at'].'T00:00:00Z');
        }
        $doc->addField('pl_visit_counter', $album_details['visit_counter'] ? $album_details['visit_counter'] : 0);
        $doc->addField('pl_user_id', $album_details['user_id'] ? $album_details['user_id'] : 0);
        $doc->addField('pl_user_first_name', $album_details['user_first_name']);
        $doc->addField('pl_user_last_name', $album_details['user_last_name']);
        $doc->addField('pl_cycle_type_id', $album_details['cycle_type_id'] ? $album_details['cycle_type_id'] : 0);
        $doc->addField('pl_cycle_title', $album_details['cycle_title']);
        $doc->addField('pl_cycle_number', $album_details['cycle_number'] ? $album_details['cycle_number'] : 0);

        foreach($album_details['signers'] as $signer_id) {
          $doc->addField('pl_album_signer_id', $signer_id);
        }

        foreach($album_details['genres'] as $genre_id) {
          $doc->addField('pl_series_genre_id', $genre_id);
        }

        foreach($album_details['targeted_public'] as $targeted_public_id) {
          $doc->addField('pl_series_targeted_public_id', $targeted_public_id);
        }        

        $updateResponse = $solr_client->addDocument($doc);
      }
      $solr_client->commit();

      return count($album_list);
    }
4

1 に答える 1

0

使用しているSolrのバージョンは何ですか? Solr4ですか?スキーマで定義していますか?

于 2012-11-13T14:43:04.967 に答える