Faceted Search And Result Reordering


Published on

A talk on Faceted Search And Result Reordering

Published in: Technology
1 Like
  • Be the first to comment

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Faceted Search And Result Reordering

  1. 1. Faceted SearchAnd ResultReorderingVarun Thacker, Unbxd Inc.
  2. 2. Agenda● Facets○ Introduction○ Multi Select Faceting○ Dynamic Range Faceting● Reordering Documents○ Default Scoring Formula○ Function Queries To Reorder Documents○ Query Elevation Component● Query Elevation Component
  3. 3. Faceted Search● Also known as guided navigation● Essentially its a group by on a field● Values returned are calculated on thedocuments from the search results
  4. 4. Brand FacetPrice FacetCountsTotal Count
  5. 5. How can we thisImplement In Solr● q = android phones● facet = true● facet.field = brand● facet.range = price● facet.range.start=0● facet.range.end=1000● facet.range.gap=100● To Filter Results: &fq=brand:"HTC"
  6. 6. Response in XML<lst name="facet_counts"><lst name="facet_queries"/><lst name="facet_fields"><lst name="brand"><int name="Samsung">293</int> <int name="HTC">100</int> ...</lst></lst><lst name="facet_dates"/><lst name="facet_ranges"><lst name="price"><lst name="counts"><int name="0">0</int> <int name="100">11</int> ...</lst><int name="gap">100</int><int name="start">0</int><int name="end">500</int></lst></lst></lst>
  7. 7. Dynamic PriceRangeTotal CountFilters AppliedFilter + Dynamic Price Range
  8. 8. Implementing DynamicPrice RangeDynamic range faceting means that we cangroup results into buckets of sizes that youwant instead of a fixed bucket range and gap● &q = *● &facet = true● &facet.field = Brand● &facet.query = Price:[0 TO 5000]● &facet.query = Price:[5001 TO 8000]● &facet.query = Price:[8001 TO 15000]● &facet.query = Price:[15001 TO *]
  9. 9. Multi-Select FacetingExampleMulti-Select Faceting gives the abilityto display facet counts despite theresult set being filteredMulti-SelectFacetinggives theability todisplay facetcounts ofother brandsdespite theresult setbeing filteredon brand HTC
  10. 10. Multi-Select FacetingImplementation● tag: Tags a filter with an arbitrary name● ex: Excludes a tag filter from being applied on afacet field/query.● key: Tags a facet field an arbitrary name (insteadof field name).To Implement In Solr:● q = android phones● facet = true● fq = {!tag=brand_tag}brand:"HTC"● facet.field = {!ex=brand_tag}brand
  11. 11. Result Options● Sort by relevancy○ Default TF-IDF Scores○ Boost cheaper products○ Boost newer products○ Boost high average user clicks and user ratings○ Boost high selling products● Fix top results on a per query basis
  12. 12. Function Queries● Apply functions to a field to alter the score ofa document● It iterates over all documents seriallyapplying the function● Can be multiplied into the score by using theboost param in the eDismax request handler
  13. 13. TF-IDF Scoring● tf - Number of times a term occurs in adocument● idf - Measure of how unique a term is● lengthNorm - Penalizes long docs with fewterm occurrences on index time.● Doesnt work well for small documents
  14. 14. Boost cheaper products● Blindly sort the result○ &sort = price asc● Give preference to cheaper products○ Boost value of 2 for the cheapest product○ Boost value of 1 for the most expensive product○ &bf = add(div(sub(price, min), sub(max, min)), 1)■ Use the StatsComponent to get min,max■ Use the min, max function queries■ Know your data and use realistic values
  15. 15. Boosting Newer Products● Blindly sort the result○ &sort = release_date desc● Give preference to Newer Products○ recip(ms(NOW/DAY,pub_date),3.16e-11,1,1)○ Where recip(m, x, a, b) = a / (mx + b)○ Picking a=2, b =1, m = 3.16e-11○ Gives a boost =2 for todays product○ Gives a boost =1.3 for 1/2 year old product○ Gives a boost =1 for 1 year old product and so on
  16. 16. Boost high marginproducts● You have a index field called margin● Again you can always sort on this field● Or you can give it subtle boosts○ Lets say you want to boost product which have amargin more than 50%○ map(margin_field, 50, 100, 2)● You can use a high selling, user ratingapproach instead too
  17. 17. Query ElevationComponent● Fix particular documents for certain queries● No scoring is taken into consideration forthese queries<elevate><query text="android phones"><doc id="nexus 4" /><doc id="pick a phone :)" exclude="true"/></query></elevate>
  18. 18. Conclusion● Facets have a lot of other use cases -Analytics. Ex. Range facets to populatehistograms● Always keep tweaking parameters andmeasuring effectiveness of your functionqueries.● Use Query Elevation Component for yourtop queries
  19. 19. Thank YouQuestions?