Search API

Step by step guide to setup Apache Solr 5.x in CentOS 7 for Drupal 7 Panopoly distro using Search API

As of this writing, the latest version of Solr is 5.2.1. In this step by step guide we will install that version and integrate it with Drupal 7 Panopoly distro site using Search API module. Actually, Panopoly distro is already shipped with Search API and Search API Solr Search modules. All we need to do is to configure the pre-setup Search API Solr server and index. The good thing about using Search API is that it is already integrated with Views module and we can do unlimited customization with our search results.

Solution on how to force re-index your Search API index application

The following codes below will just force to queue the node to your Search API index application batch process. But the actual index execution will not run yet and this depends on how often your cron runs.

// Clear field cache for the node.
cache_clear_all('field:node:' . $node->nid, 'cache_field');

// Reindex the node.
search_api_track_item_change('node', array($node->nid));

If you need to force index your Search API index application, you can use the codes below:

Adding autocomplete to custom Drupal form using Search API autocomplete module's API

The Search API autocomplete module works well on views page with exposed filter form but we know that views exposed filter form generates less clean URL for its filtered page. Using views contextual filter is the quick way to solve clean URL issue but it requires to develop your own custom search form to pass the query to this views contextual filter. This article will show how to add autocomplete feature to custom Drupal form where data shown in dropdown suggestions are pulled from Search API index using Search API autocomplete module's API.

Drupal Search API Solr spellcheck setup for foreign language

The task is to setup the spellcheck feature of Solr in Drupal for foreign language (in this article I will demonstrate enabling German language and adding new language - Filipino). The Solr spellcheck is a feature where it gives list of suggestions if there is no search result due to spelling error.