Upgrade Your Drupal Skills

We trained 1,000+ Drupal Developers over the last decade.

See Advanced Courses NAH, I know Enough

Search in Drupal 8: great opportunities and useful modules

Parent Feed: 

Convenient searching is a keystone of good website navigation and usability. Help your website users always find what they want, and they will lose all the addresses of your competitors, completely forgetting their names. It’s great that Drupal 8 has excellent search opportunities that are fulfilled by a host of helpful modules. You don’t have to to go far to seek them — we are going to give a little overview of them right now.

Drupal 8’s awesome search opportunities and modules

Core search in Drupal 8

Drupal’s core search has greatly improved in the 8th version. With nothing extra to install, the core Search module in Drupal 8 now lets you create custom search pages. These pages allow for searching for full words in any content nodes, as well as for users.

You can also decide on indexing settings and define the factors that influence the rankings (for example, the time of content creation, number of comments, keyword relevance, and more).

The core search in Drupal 8 works pretty well and is a nice choice for smaller websites that do not have much traffic or complex search needs. If this description fits you, you could order the creation of search features from a good Drupal team right now.

For more advanced search features, let’s move on to the next options.

Search API

Almost unlimited opportunities for searches in Drupal 8 are provided by the contributed Search API module. This flexible and extensible toolset is loved by Drupal developers, because it lets them to create even the most complex search interfaces.

In Drupal 8, Search API unites the functions that used to be scattered around many Drupal 7 modules. For example, it allows you to provide multiple search indexes, which you used to need a separate Search API multi-index searches module. If you are also interested in Search API’s work in Drupal 7, here is a detailed overview by our developers.

If Search API is used, the core Search module should be uninstalled to avoid conflicts like duplicate indexing.

Search API now includes Database Search submodule that provides a search backend. However, Database Search is the best fit for smaller sites, and larger ones would be better relying on more powerful and fast backends like Apache Solr or Elasticsearch.

Search API also comes packed with the Database Search Defaults module that helps with the default setup for Database Search. In addition, there is the Search API Taxonomy Term Handlers submodule that works with taxonomy.

It is awesome that Search API can index absolutely any imaginable entities in Drupal 8 from any desired data sources like content, custom blocks, comments, taxonomy, users, files, and more.

Search API lets you use highlighted search results, use stop words, apply transliteration, ignore the case, stem words for finding single-rooted words, split text into individual words — and that’s just the beginning of the out-of-box possibilities.

Combinations with other modules greatly enhance the powers of Search API. For example:

Finally, one of the greatest features of Search API is the ability to connect your site to famous search platforms like Apache Solr, Elasticsearch etc. Details are below.

Search API Solr Search

Apache Solr is a lightning-fast and powerful open-source search engine, based on Lucene and written in Java. Even websites with extremely high traffic or complex search queries are not a problem for it — Solr easily takes the load off their database.

Search features include faceted search, alternate spellings, content recommendations, highlighted results, attachment search, multisite search, and so much more.

For integrating Solr with Drupal websites, there is the Search API Solr Search module that provides a Solr backend. It work togethers with the Search API, and also needs an Apache Solr server.

By the way, we want to say congratulations on the fresh release of Search API Solr Search — on June 1, it got a stable 8.x-2.0 version!

Another great piece of news is that, as of version 8.x-2.x, the Search API Multilingual Solr Search module has merged into Search API Solr Search. It has a high level of support for non-English languages, cross-language information retrieval (CLIR) and a handy administrative interface.

We also shared with you a detailed review of Search API and Apache Solr in Drupal 7, so check that out if you are interested.

Facets

Amazon, Zappos, Walmart, eBay, and many other famous e-commerce websites have faceted searches. Basically, this means searching by multiple categories and parameters, which allows users to quickly sift out the unnecessary items and narrow down their results.

The Facets module, created purely for Drupal 8, lets site builders create interesting faceted search interfaces. It works both with the core search and the Search API. Especially popular and powerful are faceted Solr search solutions, created in combination with Apache Solr and Search API.

Elasticsearch Connector

When it comes to search platforms, Elasticsearch is a great alternative to to Solr. It is also very scalable, powerful, and flexible, based on Lucene, and written in Java. Elasticsearch can quickly index even large volumes of data. It is API-oriented and can be used with various programming languages.

Just like Solr, Elasticsearch has impressive and extensive search features. The nuances of differences between the two are worth a separate blog post. In any case, we can always help you choose what suits you best.

Of course, Drupal 8 has modules for Elasticsearch integration — for example, Elasticsearch Connector to be used together with Search API.

To recap

There are many other modules for searching in Drupal 8, and they combine with each to offer exactly what your website needs. Additional customization by developers can do miracles in fulfilling your wishes.

For choosing the suitable tools and applying them correctly, you can always rely on our Drupal development team.

We have plenty of experience with Drupal search, including the creation of a large international multi-domain online store with custom facets and Solr.

It is easy to find us without special search features — we are always here for you! ;)

Author: 
Original Post: 

About Drupal Sun

Drupal Sun is an Evolving Web project. It allows you to:

  • Do full-text search on all the articles in Drupal Planet (thanks to Apache Solr)
  • Facet based on tags, author, or feed
  • Flip through articles quickly (with j/k or arrow keys) to find what you're interested in
  • View the entire article text inline, or in the context of the site where it was created

See the blog post at Evolving Web

Evolving Web