Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>first you need install facetapi module -that's for facets. second, on hook_update_index, you need to add rating to apachesolr index</p> <pre><code>&lt;?php function module_apachesolr_update_index(&amp;$document, $node) { //add additional offers; if (count($node-&gt;field_add_offers)) { $field = $node-&gt;field_add_offers; foreach ($field as $lang =&gt; $values) { foreach ($values as $value) { if (isset($value['value'])) { $document-&gt;setMultiValue('sm_offers', $value['value']); } } } } } ?&gt; </code></pre> <p>Please note, it's just an example. I run 2 loops because of multilingual site and problem with this "und" key in field array. Here also you can not add all ratings, but calculate, for instance,one modifier per node, which will be used for sorting (if you don't have that one in ratings)</p> <p>Third, add facets with using hook_facetapi_facet_info</p> <pre><code>&lt;?php function module_facetapi_facet_info(array $searcher_info) { return array( 'sm_games_facet' =&gt; array( 'name' =&gt; 'sm_games_facet', 'label' =&gt; t('games'), 'description' =&gt; t('Filter games'), 'field' =&gt; 'sm_games', 'field alias' =&gt; 'game', 'query type' =&gt; 'term', 'default widget' =&gt; 'facetapi_links', 'allowed operators' =&gt; array(FACETAPI_OPERATOR_OR =&gt; TRUE, FACETAPI_OPERATOR_AND =&gt; TRUE), 'default sorts' =&gt; array( array('display', SORT_ASC), ), ) ); } ?&gt; </code></pre> <p>more about facets you can find at facetapi.api.php file;</p> <p>Forth - reindex content and enable facet in apachesolr settings.</p> <p>Regards, Slava</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload