Search API Solr Pro

Categories

Component ID

2914660

Component name

Search API Solr Pro

Component type

module

Maintenance status

Development status

Component security advisory coverage

not-covered

Downloads

265

Component created

Component changed

Component body

search_api_solr_pro

Module extension to prevent the entities being loaded from solr results in views by a query setting.

Motivation:

The well know module search_api_solr (https://www.drupal.org/project/search_api_solr) force the entities to beign loaded from the solr results in views, ignoring if the user only want to display specific fields that are already indexed in solr. In that case we can improve the performance of view generation avoiding the load of the entities.

Install module

Repo: Download from here!

1. Clone the repo into the drupal module folder
2. Activate the module in the drupal admin section extend Alt text
Activate Module
3. Set the solr server backend to "Solr Pro" Alt text
Enabling the backend
4. Move the index to the new server and re index them
5. Go to the view
6. Open the advance query setting dialog Alt text
Query settings
7. Check the option "Skip entity load" Alt text
Check option
8. Specified the indexed fields you want to use in the view (If the field is set as excluded for render then it will not be available in the view)
Note: In the twig file for the view you will find the fields in the row object, for example:

<li class="alpha-section__list-item">
  {% if title %}
    <h3>{{ title }}</h3>
  {% endif %}
  <ul class="alpha-section__sublist">
    {% for row in rows %}
      {%
      set row_classes = [
      default_row_class ? 'views-row',
      ]
      %}
      <li>
        {% set result_row = row.content['#row']|obj_to_arr %}
        {% set name = result_row['entity:authors/person_name'][0].getText() %}
        {% set url = result_row['search_api_id']|replace({':und': ''}) %}
        {{ link(name, url) }}
      </li>
    {% endfor %}
  </ul>
</li>

Require

Drupal 8.X
Search API Module (https://www.drupal.org/project/search_api)
Search API Solr Module (https://www.drupal.org/project/search_api_solr)