
In the first article, I talked about how to install and configure the Apache Solr search server to work with Drupal 7. Now we will talk about how to configure the index.
For those who have not read the first part, I recommend reading it for a better understanding of the material.
Let me remind you that in the settings of the search_api_solr module there are two main entities: the server and the index.
In the index settings, you can specify the fields and conditions under which Apache Solr will index the content on your site. Let us analyze the index settings in order.
')
Fields
First of all, pay attention to the fields. You can specify in the index settings the fields by which Apache Solr will index the content. To do this, select your index and go to the "Fields" tab. Here you can select indexable fields in the list available on this page. Sometimes not all fields are immediately available and you can add them using the “related fields” element. It is located at the very bottom of the page.

Add the “The main body text” field and make it indexable.
If your entity (in my example, this node) has a reference to other entities, for example, a taxonomy term, then you can search for nodes, including in the taxonomy term fields. In this way, you can add fields from several levels of related entities to the index.
For selected fields, you can specify the type of indexing. From the name of the types it is clear what they are for. Let me just say that fulltext means full-text search and Apache Solr will search not only for the whole value, but also for its part. And string is used to search by integer value. For example, for headings it makes sense to choose fulltext, and for the genre of the book (adventure, fantasy, classic ...) it is better to choose string.
In addition to the type of indexing, there is also a "field weight". With the help of weight you can control the priority of search results for each field. In this case, the higher the weight, the higher the priority of the field.
Select the required fields and save the form. I chose the title and body of the article.

If you added groups of fields through “related fields”, but did not select anything in these groups, then the fields from these groups will disappear and they will need to be added again.
Content
Now go to the workflow tab. Here you can configure content indexing rules. The first section of settings is called “Data alterations”. In it, you can add a filter by node type (Bundle filter) or exclude unpublished nodes from the index. In the case of a bundle filter, note that by default it on the contrary excludes selected content types. Therefore, do not forget to select the mode you need (exclude listed or vice versa index listed).
The second section is the processors. They allow you to perform additional data processing. For example, the processor "Ignore case" allows you to search in the index case insensitive. For most processors, you can select the fields on which they should be applied.
Select the settings you want and save the form. Now you need to return to the Status tab and re-index the content.
Another important point is that you need to enable filtering by the required fields in the presentation settings, which we used to display the search results. To do this, in the view itself, go to the Search: Fulltext search filter settings and select the fields that this filter will affect.

After that, go to the / search-results page (we set up the presentation for this page in the first article) and admire the results of the search operation.

In the next article I will tell you how to add your own fields and index settings, in case standard ones are not enough.