Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


These support forums are now closed for new topics and comments.
Please head on over to http://eureka.ucommerce.net/ for support.

  • Chris 34 posts 134 karma points
    Jun 03, 2015 @ 14:29
    Chris
    0

    Price facet returns

    In one of my categories have products ranging in price from £21.54 - £165.00. When calling the below code the price Facet contains 5 Facet Values, 3 of which have 0 Hits.

    SearchLibrary.GetFacetsFor(category, facets)
    

    What I'd expect to happen here, is the Price Facet would only return Facet Values that have hits > 0, and the price ranges would correspond to the products in that category. One of the Facet Values with 0 hits had a price range of £1548 - £1602 which is a lot higher than anything in that category.

    I've tried editing the Search.config file to be like below, but now I just get 30 Facet Values returned, 28 with 0 hits (still only 2 actually have values):

    <component id="ProductPriceRangeFacetIndexer"
                 service="UCommerce.Search.IIndexer`1[[UCommerce.EntitiesV2.Product, UCommerce]], UCommerce"
                 type="UCommerce.Search.Indexers.ProductIndexers.ProductPriceRangeFacetIndexer, UCommerce">
             <parameters>
                 <numberOfRanges>30</numberOfRanges>
             </parameters>
         </component>
  • Søren Spelling Lund 1793 posts 2744 karma points
    Jun 16, 2015 @ 09:35
    Søren Spelling Lund
    0

    Hi Chris,

    This behavior is by design so you have to choice of display facets with zero hits or not.

    If you don't want them you can filter the return facets based on the number of hits before displaying.

    There's an example in Avenue Clothing on how to this:

    https://bitbucket.org/uCommerce/ucommerce-razor-store/src/e2f4b535c423165cd4dc20810b2f817693f482dd/src/uCommerce.RazorStore/macroScripts/uCommerce/Facets.cshtml?at=default

    Hope this helps.

  • Chris 34 posts 134 karma points
    Jun 17, 2015 @ 09:37
    Chris
    0

    Hi Soren,

    Thanks for the response. We are already filtering out the facets with zero hits, what I was hoping to find is a way of returning price Facets with ranges in the category being searched for.

    The price facet ranges returned seem to be for the entire site and not just the category I'm querying against. The prices for items in my website range from £1.80 to £1400 so when querying against the entire product set getting very wide price ranges make sense, these are the ranges retrieved:

    • £0 - £161
    • £160 - £321
    • £320 - £481
    • £801 - £962
    • £1281 - £1442

    However when querying against a specific category that only has products with prices in the range £10.76 - £44.10 only 1 price facet that has hits is returned:

    • £0 - £161

    Is this a bug or by design? If it's by design is there a way of overriding this behavior to get something like this:

    • £10 - £19
    • £20 - £25
    • £26 - £34
    • £35 - £41
    • £42 - £45

    Thanks

  • Søren Spelling Lund 1793 posts 2744 karma points
    Jun 18, 2015 @ 10:48
    Søren Spelling Lund
    0

    This is by design. The reason for this is that the ranges are determined by the facet itself, which means that they're defined globally.

    You could change the facet to include more ranges with a narrower scope and dynamically change the number returned when you know which ranges are available.

    Hope this helps.

Please Sign in or register to post replies

Write your reply to:

Draft