Auto Complete Suggestions Implementation Using Apache Solr – Approach3

Apache Solr

              In the previous articles, we have seen the auto-suggests setup with Apache Solr.  In these days,  the user experience has changed a lot and the way the sites are presenting the auto-suggestions to the user is also changed.  Most of the web sites are not presenting auto suggestions as simple text messages. For example, if you are searching for a movie DVD, they are suggesting film names, along with that they are displaying the thumbnail image of DVD poster, the short description, the cast acted in that movie. So, the user is going to get more information from the auto-suggestions.  In the below picture, the suggestions contain popular products with image, price and the movie name.

Sample Auto Suggestions

                 If we want to provide the information what we are seeing in the above picture, we need to enhance the configuration which we have done in PART-1 or PART-2. In this example, we are using the sample movie database and the data is available here.

The analysis configuration provided in the schema.xml is given below.


The fields configuration provided in the schema.xml is given below.


            If you perform a search operation for “win” keyword and the response is giving the movie names along with thumbnail image and the short description of the film. The sample response is given below.

         Rear Window (1954)
         A visceral black-and-white drama about an aging boxer (Robert De Niro), Martin Scorsese's 1980 flick is one of the best of its decade.
         Gone With The Wind (1939)
         Victor Fleming's 1939 star-studded Civil War tour de force finds Clark Gable and Vivien Leigh entangled in a fiery love affair.

                 The configuration used in this article is available here. We have seen different variations of setup for auto-suggestions using Apache Solr. Now, you can implement any of these in your applications.


Siva Janapati is an Architect with experience in building Cloud Native Microservices architectures, Reactive Systems, Large scale distributed systems, and Serverless Systems. Siva has hands-on in architecture, design, and implementation of scalable systems using Cloud, Java, Go lang, Apache Kafka, Apache Solr, Spring, Spring Boot, Lightbend reactive tech stack, APIGEE edge & on-premise and other open-source, proprietary technologies. Expertise working with and building RESTful, GraphQL APIs. He has successfully delivered multiple applications in retail, telco, and financial services domains. He manages the GitHub( where he put the source code of his work related to his blog posts.

Tagged with:
Posted in Apache Solr, Auto Suggestions
12 comments on “Auto Complete Suggestions Implementation Using Apache Solr – Approach3
  1. Aronsky says:

    Hi, Siva! Thanks for your posts about SOLR Suggestions – I got some bricks from them for understanding the whole picture.
    I have a requirement, which do not know yet how to implement better, maybe you could help me? I need the possibility to show the top categories where the suggestion could me met – like on your picture:

    [god of war in Games]
    [godfather in Books]
    [godfather in Posters]
    [god of small things]

    Which is the best option to implement this in one query?

  2. Anonymous says:

    Will it works on Solr 4.10 ?

  3. Anonymous says:

    Will it work on Solr 4.10 ???

  4. Anonymous says:

    Wil it work in Solr 4.10 ?

  5. Will it work for solr 3.6.2?

  6. Yesuraj G says:

    Very good explanation. Thanks for your effort.

  7. Anonymous says:

    Nice Explanation.. thanks

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.


Java Code Geeks
Java Code Geeks
%d bloggers like this: