Sorting data on the basis of a function value
Suppose we have a search application that stores information about companies. Every company is described by a name and two floating point numbers that represent the geographical location of the company. One day your boss comes to your room and says that he wants the search results to be sorted by distance from the user's location. What's more, he wants us to force our search engine to return the distance from a user location to each of the returned companies. This recipe will show you how to achieve this requirement.
How to do it...
Let's perform the following steps to sort data on the basis of a function value:
- For this recipe, we will begin with the following index structure (add the following entries ...
Get Solr Cookbook - Third Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.