Another Word For It Patrick Durusau on Topic Maps and Semantic Diversity

June 10, 2013

Search-As-You-Type With Solr

Filed under: Lucene,Searching,Solr — Patrick Durusau @ 9:53 am

Search-As-You-Type With Solr by John Berryman.

From the post:

In my previous post, I talked about implementing Suggest-As-You-Type using Solr. In this post I’ll cover a closely related functionality called Suggest-As-You-Type.

Several years back, Google introduced an interesting new interface for their search called Search-As-You-Type. Basically, as you type in the search box, the result set is continually updated with better and better search results. By this point, everyone is used to Google’s Search-As-You-Type, but for some reason I have yet to see any of our clients use this interface. So I thought it would be cool to take a stab at this with Solr.

Let’s get started. First things first, download Solr and spin up Solr’s example.

cd solr-4.2.0/example
java -jar start.jar

Next click this link and POOF! you will have the following documents indexed:

  • There’s nothing better than a shiny red apple on hot summer day.
  • Eat an apple!
  • I prefer a Grannie Smith apple over Fuji.
  • Apricots is kinda like a peach minus the fuzz.

(Kinda cool how that link works isn’t it?) Now let’s work on the strategy. Let’s assume that the user is going to search for “apple”. When the user types “a” what should we do? In a normal index, there’s a buzillion things that start with “a”, so maybe we should just do nothing. Next “ap” depending upon how large your index is, two letters may be a reasonably small enough set to start providing feedback back to your users. The goal is to provide Solr with appropriate information so that it continuously comes back with the best results possible.

Good demonstration that how you form a query makes a large difference in the result you get.

No Comments

No comments yet.

RSS feed for comments on this post.

Sorry, the comment form is closed at this time.

Powered by WordPress