Organizational Research By

Surprising Reserch Topic

Question:What is faceted search?


What is faceted search?

Faceted search is the clustering of search results into categories, allowing users to drill into search results. By showing the number of hits for each facet category, users can easily see how many results match that category.

If you're still a bit confused, this example from CNET explains it all:

image
 

The SQL solution for faceted search

Our ("pre-Solr") solution for faceted search was done by adding a lot of redundant columns to our SQL tables and doing a COUNT(...) for each of those columns:

image

So if a user was searching for real estate properties in the city 'Amsterdam', our facet-query would be something like:

SELECT COUNT(hasGarden), COUNT(yearBuilt1930_1940), COUNT(yearBuilt1941_1950), COUNT(etc...)
FROM Houses
WHERE city = 'Amsterdam'

While this solution worked fine for a couple of years, it wasn't very easy for developers to add new facets. And also, performing COUNT's on all matched rows only performs well if you have a limited amount of rows in a table (i.e. less than a million rows).


asked Sep 13, 2013 in SOLR by rajesh
edited Sep 12, 2013
0 votes
124 views



Related Hot Questions

2 Answers

0 votes
"Solr is an open source enterprise search server based on the Lucene Java search library, with XML/HTTP and JSON APIs, hit highlighting, faceted search, caching, replication, and a web administration interface."

Solr isn't a database, it's more like a big index. Every time you upload data to Solr, it will analyze the data and create an inverted index from it (like the index-pages of a book). This way Solr can lookup data very quickly. To explain the inner workings of Solr is beyond the scope of this post, but if you want to learn more,

Getting faceted search results from Solr is very easy; first let me show you how to send a http-query to Solr:

http://localhost:8983/solr/select?q=city:Amsterdam

This will return an XML document containing the search results (in this example only three houses in the city of Amsterdam):

   
     
         
            3203
            Amsterdam
            Keizersgracht
            false
            1932
        

        
            3205
            Amsterdam
            Vondelstraat
            true
            1938
         

         
            4293
            Amsterdam
            Trompstraat
            true
            1949
         

      

   


By adding a facet-querypart for the fields "hasGarden" and "yearBuilt", Solr will return the facets for those particular fields.

...&facet.field=hasGarden&facet.query=yearBuilt:[1930 TO 1940]&facet.query=yearBuilt:[1941 TO 1950]

The complete XML response from Solr now looks like this (note the "face_counts" node at the end of the result-XML returned by Solr):

   
      
         
            3203
            Amsterdam
            Keizersgracht
            false
            1932
         

         
            3205
            Amsterdam
            Vondelstraat
            true
            1938
         

         
            4293
            Amsterdam
            Trompstraat
            true
            1949
         

      

      
         
            2
            1
         

         
            
               2
               1
            

         

      

   
answered Sep 13, 2013 by rajesh
edited Sep 12, 2013
0 votes
"Solr is an open source enterprise search server based on the Lucene Java search library, with XML/HTTP and JSON APIs, hit highlighting, faceted search, caching, replication, and a web administration interface."

Solr isn't a database, it's more like a big index. Every time you upload data to Solr, it will analyze the data and create an inverted index from it (like the index-pages of a book). This way Solr can lookup data very quickly. To explain the inner workings of Solr is beyond the scope of this post, but if you want to learn more,

Getting faceted search results from Solr is very easy; first let me show you how to send a http-query to Solr:

http://localhost:8983/solr/select?q=city:Amsterdam

This will return an XML document containing the search results (in this example only three houses in the city of Amsterdam):

   
     
         
            3203
            Amsterdam
            Keizersgracht
            false
            1932
        

        
            3205
            Amsterdam
            Vondelstraat
            true
            1938
         

         
            4293
            Amsterdam
            Trompstraat
            true
            1949
         

      

   


By adding a facet-querypart for the fields "hasGarden" and "yearBuilt", Solr will return the facets for those particular fields.

...&facet.field=hasGarden&facet.query=yearBuilt:[1930 TO 1940]&facet.query=yearBuilt:[1941 TO 1950]

The complete XML response from Solr now looks like this (note the "face_counts" node at the end of the result-XML returned by Solr):

   
      
         
            3203
            Amsterdam
            Keizersgracht
            false
            1932
         

         
            3205
            Amsterdam
            Vondelstraat
            true
            1938
         

         
            4293
            Amsterdam
            Trompstraat
            true
            1949
         

      

      
         
            2
            1
         

         
            
               2
               1
            

         

      

   
answered Sep 13, 2013 by rajesh
edited Sep 12, 2013

...