0

ここに画像の説明を入力

やあ、

私は drupal 7 、Apache solr 統合モジュールと solr 添付モジュールを持っています。以前にその通知を受け取ったことはありませんでしたが、検索スニペットが表示されない理由がわかりません。通知に記載されているコードを見て、print_r($snippets) を実行したところ、スニペットが変数のどこにあり、検索結果に表示されないことがわかりました。この理由は何ですか?

solrconfig.xml

<requestHandler name="drupal" class="solr.SearchHandler" default="true">
 <lst name="defaults">
   <str name="defType">dismax</str>
   <str name="echoParams">explicit</str>
   <bool name="omitHeader">true</bool>
   <float name="tie">0.01</float>
     <str name="pf">
       content^2.0
     </str>
   <int name="ps">15</int>
   <!-- Abort any searches longer than 4 seconds -->
   <!-- <int name="timeAllowed">4000</int>  -->
   <str name="mm">1</str>
   <str name="q.alt">*:*</str>

   <!-- example highlighter config, enable per-query with hl=true -->
   <str name="hl">true</str>
   <str name="hl.fl">content</str>
   <int name="hl.snippets">1</int>
   <str name="hl.mergeContiguous">true</str>
   <!-- instructs Solr to return the field itself if no query terms are
    found -->
   <str name="f.content.hl.alternateField">teaser</str>
   <str name="f.content.hl.maxAlternateFieldLength">256</str>
   <!-- JS: I wasn't getting good results here... I'm turning off for now
    because I was getting periods (.) by themselves at the beginning of
    snippets and don't feel like debugging anymore.  Without the regex is
    faster too -->
    <!--<str name="f.content.hl.fragmenter">regex</str>--> <!-- defined below -->

  <!-- By default, don't spell check -->
     <str name="spellcheck">false</str>
  <!-- Defaults for the spell checker when used -->
    <str name="spellcheck.onlyMorePopular">false</str>
    <str name="spellcheck.extendedResults">false</str>
    <!--  The number of suggestions to return -->
    <str name="spellcheck.count">1</str>
  </lst>
  <arr name="last-components">
   <str>spellcheck</str>
  </arr>
 </requestHandler>

これは、apachesolr_attachments.module にある通知のコードです。

enter code here
function theme_apachesolr_search_snippets__file($vars) {
  $doc = $vars['doc'];
  $snippets = $vars['snippets'];
  $parent_entity_links = array();

   // Retrieve our parent entities. They have been saved as
   // a small serialized entity
 foreach ($doc->zm_parent_entity as $parent_entity_encoded) {
 $parent_entity = (object) drupal_json_decode($parent_entity_encoded);
 $parent_entity_uri = entity_uri($parent_entity->entity_type, $parent_entity);
 $parent_entity_uri['options']['absolute'] = TRUE;
 $parent_label = entity_label($parent_entity->entity_type, $parent_entity);
 $parent_entity_links[] = l($parent_label, $parent_entity_uri['path'],     $parent_entity_uri['options']);
 }

if (module_exists('file')) {
  $file_type = t('!icon @filemime', array('@filemime' => $doc->ss_filemime, '!icon' => theme('file_icon', array('file' => (object) array('filemime' => $doc->ss_filemime)))));
}
else {
   $file_type = t('@filemime', array('@filemime' => $doc->ss_filemime));
}
//print_r($snippets);echo "\n";
return implode(' ... ', $snippets) . '<span>' . $file_type . ' <em>attached to:</em>' .  implode(', ', $parent_entity_links) . '</span>';

}

schema.xml

<field name="id" type="string" indexed="true" stored="true" required="true" />
<field name="name" type="string" stored="true" indexed="true"/> 
<!-- entity_id is the numeric object ID, e.g. Node ID, File ID -->
<field name="entity_id"  type="long" indexed="true" stored="true" />
<!-- entity_type is 'node', 'file', 'user', or some other Drupal object type -->
<field name="entity_type" type="string" indexed="true" stored="true" />
<!-- bundle is a node type, or as appropriate for other entity types -->
<field name="bundle" type="string" indexed="true" stored="true"/>
<field name="bundle_name" type="string" indexed="true" stored="true"/>
<field name="text" type="text" stored="true" indexed="true"/>   
<field name="site" type="string" indexed="true" stored="true"/>
<field name="hash" type="string" indexed="true" stored="true"/>
<field name="url" type="string" indexed="true" stored="true"/>
<!-- label is the default field for a human-readable string for this entity (e.g. the  title of a node) -->
<field name="label" type="text" indexed="true" stored="true" termVectors="true" omitNorms="true"/>
<!-- The string version of the title is used for sorting -->
<copyField source="label" dest="sort_label"/>
<!-- content is the default field for full text search - dump crap here -->
<field name="content" type="text" indexed="true" stored="true" termVectors="true"/>
<field name="content_type" type="string" indexed="true" stored="true" multiValued="true"/>
<field name="teaser" type="text" indexed="false" stored="true"/>
<field name="language" type="text_en" stored="true" indexed="true"/>
<field name="path" type="string" indexed="true" stored="true"/>
<field name="path_alias" type="text" indexed="true" stored="true" termVectors="true" omitNorms="true"/>
<field name="created" type="string" indexed="true" stored="true" termVectors="true"/>
<field name="Question" type="text" indexed="true" stored="true" termVectors="true"/>
<field name="Response" type="text" indexed="true" stored="true" termVectors="true"/>
<field name="Module" type="text" indexed="true" stored="true" termVectors="true"/>
<field name="Meets" type="text" indexed="true" stored="true" termVectors="true"/>
<field name="cat" type="string" indexed="true" stored="true" termVectors="true"/>

通知を取り除き、スニペットを表示するための提案はありますか?

4

1 に答える 1