How to add a search function to a website on Drupal with superfast Lunr.js
When your website users are able to quickly find what they are looking for, you naturally get more conversions. A good UX consultant will always recommend you to add a search function to a website.
Read on to discover more details about why search is important. If you are using Drupal, this post will be of special interest to you because we will describe how to make the website search functionality really fast and user-friendly with Lunr.js.
Why is search important on a website?
Many customers ask “Does my website need a search?". On large and complex websites, an internal website search is a must-have in order to improve website navigation. The decision to add a search box to a website is especially vital for content-rich websites, e-commerce stores, knowledge bases, and so on.
However, it is also very helpful for small and medium-sized websites. Here we will discuss the ways search functionality on any website, when it is fast and user-friendly enough, can benefit its owner:
- If a user finds what they need through the search box quickly, they are likely to purchase it.
- Search results give you new ideas about products or services users are interested in.
- You get information about user behavior for your marketing strategies.
- A search feature on your website provides you with new SEO keywords.
- Adding search functionality to a website makes your design more customer-centric.
- A search box increases your session duration and reduces the bounce rate.
You can always reach out to our web development team for a free consultation and further creation of a search feature on your website at very affordable prices. We respect your budget and will recommend a fast, easy-to-use, and efficient search solution that will not require extra costs. Meanwhile, let’s discuss how search functionality is created on websites.
How to add a search function to a website built with Drupal?
The answer to the question about how to set up search functionality on a website, depends on the CMS you are using. Each CMS has its own special extensions that provide for the search feature.
In Drupal, to create basic search options for smaller sites, the built-in Search module is enough. It allows your users to search for full words in Drupal entities (content nodes, users, etc.). You can also specify the indexing settings and choose the ranking factors like:
- publication time
- activity in comments
- keyword relevance
Through the use of extra modules, Drupal websites can also get more complex search features like:
- faceted search
- search by alternate spellings
- similar content suggestions
- result highlighting
- search through attachments
- multisite search
- and much more
To achieve this, they connect to robust search platforms like Apache Solr or Elasticsearch through contrib modules like Search API Solr Search and Elasticsearch Connector, as well as using modules like Search API, Facets, and many more.
Superfast and easy-to-use internal website search with Lunr.js
What is Lunr?
Lunr.js is a full-text search library to use in the browser. It is a small but full-featured library that provides great search experiences. Lunr.js offers a simple search interface for finding the content that best matches the search queries. It requires no server-side search services and needs no external dependencies.
You might have noticed its “lunar” brand design. Lunr.js is an alternative to the famous search engine Solr. “A bit like Solr, but much smaller and not as bright,” is the official slogan of Lunr.
A sum-up of Lunr.js search features
- instant search results with suggestions
- client-side search without overloading Drupal
- keyword-based search
- partial and fuzzy search options
- a scoring system for showing relevant results
- location history
- lazy-loading search results
- and more
Modules for the integration between Lunr.js and Drupal
Search API Lunr
The Search API Lunr module provides a Search API backend Lunr search with configurable fields. Instead of adding content to a search back-end, JSON files are loaded directly into the browser.
Add a search feature to your website with our experts!
Ready to give your website a new boost through adding a search functionality? Our website support agency experts are ready to do it at affordable prices.
Contact us and let’s discuss your best price!