Developer forum

Forum » Development » Get Facet Boost value in Front-end

Get Facet Boost value in Front-end

Dmitrij Jazel
Reply

Hi Guys,

we have new index setted-up, and some fields with Boost value.

When Looping through "Facets" loop, Have this template tags.

But none of them refers to Boost, does it?

Index Tag Length of value Value (First 100 chars)
0 <!--@Facet.Field--> 11 AuthorFacet
1 <!--@Facet.Name--> 6 Author
2 <!--@Facet.OptionCount--> 4 1640
3 <!--@Facet.OptionResultTotalCount--> 1 7
4 <!--@Facet.OptionWithResultCount--> 1 3
5 <!--@Facet.QueryParameter--> 6 Author
6 <!--@Facet.Type--> 5 Field
7 <!--@Facets.LoopCounter--> 1 1
8 <!--@Facets.LoopMod2--> 1 1
9 <!--@Facets.LoopMod3--> 1 1
10 <!--@Facets.LoopMod4--> 1 1
11 <!--@Facets.LoopMod5--> 1 1
12 <!--@LoopStart(FacetOptions)--> <!--@LoopEnd(FacetOptions)--> 1

If not, than this probably could be a great feature request?

/Dmitrij


Replies

 
Dmitrij Jazel
Reply

Bump...

 
Jeppe Eriksson Agger Dynamicweb Employee
Jeppe Eriksson Agger
Reply

Hi Dmitrij,

A boost value is not related to a facet but to a field in the index, so I don't quite know what you're asking for. You don't have the index fields in frontend -- mainly because you don't need them -- so a boost value is of no use to you. If you want to know the score of a result from the index, you can use the QueryPublisher to get that. The key for that is called _score. Score is currently not available in the Product Catalog template.

Maybe I misunderstand you, so please let me know if I do.

- Jeppe

 
Dmitrij Jazel
Reply

Hi Jeppe,

Happy new year to you! :)

 

No you got it just right, thanks for the answer :)

 

I will try looking into _score. a bit sad that I must use QueryPublisher to get it, and can't get it dirrectly in the product catalog, But alteast you have it on your radar.

What we need is basically a way to sort filter properties depending on what boost value we gave them.

 

Because right now, when you are looping the facet, there is no way to sort filters exactly the way you want it (or how customer would like it) in the front-end.

Like f.eks. Page sort in the CMS. You can sort pages, the way you like it. Would be great to have simmilar possibility for filters aswell.

 

/Dmitrij

 
Jeppe Eriksson Agger Dynamicweb Employee
Jeppe Eriksson Agger
Reply

I still don't quite understand what you're trying to achieve.

You boost a field in the index, so if a value in that field is matched by your query, that result will be ranked higher. Notice that I talk about the result, not the facets or the facet options. Only results are affected by boosting. The order of facets is controlled by you in the facets configurations -- the order in the loop is the same order as in the configuration. By default, the values are ordered alphabetically, but if you use a Razor template, you can control the order manually; you can also use Razor to order the facets if you wanted -- instead of using the defined order.

Results can be sorted based on the score. The score is affected by the boost on the fields used to match that specific result. The higher the boost value on a matching field, the higher the score. As I stated in my previous post, the score value is currently only available when you use the Query Publisher. You can implement a Notification Subscriber that listens for the AfterQuery notification. This gives you access to the complete search result from the index, including the score. Then you could add the value to a template extender or some other extension and get it into your template. Most of the time though, what you really want is to be able to sort the result using the score and perhaps some other fields. This options is coming in DW8.8 where score is available as a separate sort field.

- Jeppe

 
Nicolai Høeg Pedersen
Reply
This post has been marked as an answer

Hi Dmitrij

You can, as a workaround, change the order of the facets in the XML file - that would also change the rendering order.

BR Nicolai

Votes for this answer: 1
 
Dmitrij Jazel
Reply

Hi Nicolai and Jeppe, sorry for missleading forum post, but yes that is actually what we needed (Nicolais answer).

Thanks for help on this one! :-)

/Dmitrij

 

 

You must be logged in to post in the forum