# Fine tuning the search configuration

After selecting the proper environment and plugins, there are a few tricks to increase search performance.

## High performance impact changes

These changes are recommended on most **shared hosts** and lower performance servers, as well as in cases with thousands of posts. These changes can improve the search performance significantly.

### For big databases - Use the Index WP MySQL For Speed plugin

If you have a relatively big database, then the [Index WP MySQL For Speed](https://wordpress.org/plugins/index-wp-mysql-for-speed/) is a amazing tool to generate additional indexes on database tables like the posts, post metadata, users etc.. It can yield a **huge performance gain** for your overall site as well as the queries.

{% hint style="danger" %}
**WARNING!** Please be **very careful** when using any database altering tools. Make sure to have a full website backup before initiating any commands or changes.
{% endhint %}

### Use the index table engine

If your main results are Posts, Pages, Products or other custom post types, you should definitely consider using the [Index Table engine](https://documentation.ajaxsearchpro.com/index-table).

{% embed url="<https://youtu.be/XQmrTlvQcTk>" %}

Using the index table engine is **highly recommended** if:

* there are over 1000 posts or the post contents are lengthy
* searching by [categories (or tags or any other term)](https://documentation.ajaxsearchpro.com/general-settings/search-in-terms-categories-tags...) is neccessary
* searching by [custom fields](https://documentation.ajaxsearchpro.com/general-settings/search-in-custom-fields)
* searching in media files

### Disable search when typing

While it's a great feature, it requires a decent server to handle. Shared hosts tend to have an execution limit, which can be reached very quickly with constant ajax requests.

To disable this feature go to the `Search Sources -> Live Search Triggers` panel. t to 'Trigger live search' (see screenshot).

<figure><img src="https://1706764988-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-L9jkFgNo4lpUof35gvS%2Fuploads%2FPdX33p8R8VsPTQdeaTLq%2Fimage.png?alt=media&#x26;token=97cab452-1aad-4dd5-969b-f65eb83aa28c" alt="" width="375"><figcaption></figcaption></figure>

&#x20;After this change the user will have to hit the Return key or click the magnifier icon to start the ajax search process (depending on your configuration).

### Front-end filters

{% hint style="danger" %}
Front-end filters are effective even if they are visually turned off! To disable them, they have to be removed on the search configuration.
{% endhint %}

Using [front-end filters](https://documentation.ajaxsearchpro.com/frontend-search-settings) can be a major blow for the overall search performance, especially when combining a lot of filters on a large set of results.

* Make sure to minimize the number of front-end filters
* Remove the less important filters if possible
* Use them in combination with the [search cache](https://documentation.ajaxsearchpro.com/performance-tuning/cache)

### Exclusions or inclusions by taxonomy terms or tags

The exclusion/inclusion documentation [can be found here](https://documentation.ajaxsearchpro.com/advanced-options/excluding-and-including-results).

* Minimize the number of items excluded/included - instead of excluding/including by multiple child categories, exclude the parent category only etc..
* Do not use the inclusions and exclusions at the same time. In that case using an [inclusion](https://documentation.ajaxsearchpro.com/advanced-options/excluding-and-including-results/include-by-categories-or-terms) should be sufficient, as everything else is excluded.

### Disable autocomplete, or use only google as autocomplete source

Autocomplete is triggered on every keystroke, so just like the previous option - unless only google is selected as the source. In that case your server is not invoked in the process.

**Solution 1:**

<figure><img src="https://1706764988-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-L9jkFgNo4lpUof35gvS%2Fuploads%2FKLGNMKEJLoNXLeRMKFJp%2Fimage.png?alt=media&#x26;token=097cf260-29e6-4ce6-b69e-158b1906390c" alt="" width="375"><figcaption></figcaption></figure>

**Solution 2:**

<figure><img src="https://1706764988-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-L9jkFgNo4lpUof35gvS%2Fuploads%2F8bBCy9xkxsKYXGyYLuic%2Fimage.png?alt=media&#x26;token=5a4d83bd-033c-40d9-8596-239d9139a374" alt="" width="375"><figcaption></figcaption></figure>

### Disable secondary (fill) logic

By default this feature is disabled, but in case you decided to use it, it can cause a decent performance slowdown.

To turn it off, go the the `Search Behavior -> Keyword logic & matching`panel and set the "Secondary logic" option:

<figure><img src="https://1706764988-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-L9jkFgNo4lpUof35gvS%2Fuploads%2FhZkFnyVyrZbZAcrgwh1F%2Fimage.png?alt=media&#x26;token=6d780f16-bc24-422e-a365-09b854dd55e0" alt="" width="375"><figcaption></figcaption></figure>

### Enable the search cache

There is a built-in, optional file and database based search cache. To enable it, go to the **Cache Settings** submenu.

![Cache Settings](https://1706764988-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-L9jkFgNo4lpUof35gvS%2F-LeqXhPlLNBdp0PMUwdr%2F-LeqYKlx4BFSrSXq18ne%2Fimage.png?alt=media\&token=e41c3d24-3343-40d5-8e98-ac49a2e1df4e)

There is either a **File** or **Database** caching method. We recommend trying both to find out which one works in your case faster.

## Medium performance impact changes

These changes can have a relateively big impact on the overall performance.

### Enabling the custom ajax handler

As discussed in the previous section, the ajax performance is unfortunately affected by every single plugin you have installed.

However there is an implemented custom ajax handler, which can try to bypass unneccessary plugin loading, making this process faster.

To enable the custom ajax handler, click the `Compatibility Settings` submenu.

![](http://i.imgur.com/IG2m6Zu.png)

### Disable image cropping

Cropping images to thumbnails can cause a definite slowdown, mostly in cases where the source images are too big. Image cropping can be disabled on the `Caching options` page:

![](http://i.imgur.com/PxVAGs7.png)
