---
title: "Obtaining relevant search results"
date: "2024-02-14T06:18:38+00:00"
summary: "Optimize your Drupal search results with expert tips on configuring modules, customizing Solr, and leveraging UI options. Learn how to boost relevance and monitor user search experiences effectively."
image:
type: "page"
url: "/acquia-cloud-platform/obtaining-relevant-search-results"
id: "ff2c28fb-eb2e-4546-8a6d-55fc594d7770"
---

Drupal modules related to Search provide hooks and user interface options to ensure that the results are relevant to the searches. The most suitable combination of hooks and settings depends on the architecture of your application, the behavior of the site visitors, and user testing.

To receive the best results, follow the methods listed for your version of Drupal. Ensure that you test your changes and obtain feedback.

[Current Drupal Version](/service-offerings/support/support-users-guide/supported-software-life-cycle#supported-drupal-version)
-------------------------------------------------------------------------------------------------------------------------------

*   Use the [search\_api\_solr](https://www.drupal.org/project/search_api_solr) module with Solr.
    
    You can use this module with the [current Drupal version](/service-offerings/guide/software-life-cycle?previewMode=current#supported-drupal-version) and with Drupal 7.
    
*    Use a combination of the following customizations to provide an effective search experience to users:
    *   Configure your search experience using the [search\_api\_solr](https://www.drupal.org/project/search_api_solr) configurations from the Drupal backend and your search views.
    *   Use contributed or custom modules that extend the functionality of the [search\_api\_solr](https://www.drupal.org/project/search_api_solr) module.
        
        For information about the modules, visit [Ecosystem modules for Search API Solr](https://www.drupal.org/project/search_api_solr/ecosystem).
        
    *   Make changes in the Solr configset or schema. The schema is a set of configuration files deployed on your Solr index. These configuration files define the behavior of Solr.
        
        For more information, visit [Solr configuration files](https://solr.apache.org/guide/8_0/solr-configuration-files.html).
        
        Additional resources
        
        *   For information about boosting search results, visit the [official page](https://www.drupal.org/docs/extending-drupal/contributed-modules/contributed-module-documentation/search-api-solr).
        *   For information about configuring the [search\_api\_solr](https://www.drupal.org/project/search_api_solr) module, visit [drupalize.me](https://drupalize.me/course/search-api-and-solr-drupal).
        *   For information about improving search results for a specific use case, visit [Tuning Drupalize.Me Search Results with Solr Query Re-Ranking and Search API](https://drupalize.me/blog/tuning-drupalizeme-search-results-solr-query-re-ranking-and-search-api).
        

Drupal 7 with apachesolr
------------------------

*   Use biasing options in the Drupal user interface to:
    *   Tweak result ordering by newness or by entity type.
    *   Give more importance to matches in taxonomy terms, titles, or other fields.
        
        To view biasing options for your application:
        
        *   Sign in to your Drupal application as an administrator.
        *   Go to **Configuration** > **Apache** **Solr** **Search** > **Settings**.
        *   Click **Bias** next to the search environment you want to edit.
        
        For more information, visit [Using bias to tune search results](/acquia-cloud-platform/using-bias-tune-search-results "Using bias to tune search results"). For example, an easy way to prioritize items on search results is to mark those nodes as sticky at top of lists. You must also work with your editors to understand when and how to configure this flag.
        
*   Use modules such as [Apachesolr Term Proximity](https://drupal.org/project/apachesolr_proximity) to boost matching terms and provide better results to users when they are searching for phrases.
    
    For example, a search for `parking permits` will boost the items with the exact phrase in their contents before the items with the words shown separately.
    
*   Create custom code that implements hooks. Hooks such as `hook_apachesolr_query_alter()` change the queries sent to Solr as those queries are being made. Hooks can also introduce complex boosting or ordering commands onto the Solr query.
*   Use the [Apache Solr Not a Node](https://www.drupal.org/project/apachesolr_nan) module for indexing items that are not nodes.
    

Solr configuration options
--------------------------

You can modify your Solr configurations to improve your search results.

Note

*   Acquia recommends you to change these files only if you are knowledgeable with Solr. Acquia Support cannot help you debug issues relating to changes to these files.
*   Acquia-hosted Solr instances (Acquia Search) contain limits to the files that can be changed. For more information, see [Custom Solr configuration](/acquia-cloud-platform/features/acquia-search/customizing/config-solr).

*   Create hard overrides of the searching behavior by editing the following text files in your Solr configuration:
    *   `synonyms.txt` - Allows you to swap words
        
        For example, a search for `garage` can only match `parking`, or searches for both `garage` and `parking` can be equivalent and match either `garage` or `parking` in content.
        
    *   `protwords.txt` - Allows you to force Solr to always take words as they are and not cut them down to their root
        
        This prevents Solr from [stemming](http://en.wikipedia.org/wiki/Stemming) words. Normally, a search for `parking` will match `park`, `parks`, and `parker`, but adding `parking` to `protwords.txt` ensures that searches will only match the exact term: `parking`.
        
    *   `elevate.xml` - Allows you to force certain items to show up among the first results for a specific search. To learn more read [Configuring the Query Elevation Component](https://lucene.apache.org/solr/guide/6_6/the-query-elevation-component.html#TheQueryElevationComponent-elevate.xml).
        
        For example, modifying this file allows you to always display `parking` as the first result when website visitors search for phrases like `parking` or `where to park`. The [Solr best bets](https://drupal.org/project/solr_best_bets) module can help you construct this file. Once you have created and tested a version of this file, [create a Support ticket](/service-offerings/support#contact-acquia-support) to begin its placement on your server.
        
    *   `stopwords.txt` - Allows you to tell Solr which words are not meaningful and should be dropped from queries and indexing.

Monitoring website visitors’ search experiences
-----------------------------------------------

You can use various tools to track searches and see what your visitors are looking for. Tracking low-result and no-result searches help you with an editorial strategy to put content into the hands of those visitors.

Due to Varnish® caching, Drupal-side logging of searches does not provide you all the data around what is being searched for on your website, while a client-based (JavaScript) option does. For example, the [Apache Solr Statistics](https://www.drupal.org/project/apachesolr_stats)module does not properly log all searches while working under Varnish®.