#community-help

Prioritizing Brand Partner Results in Data Structure

TLDR Digamber sought advice on prioritizing brand partner results in an arbitrary list. Kishore Nallan suggested using sorting on boolean field brand_partner to achieve this.

Powered by Struct AI

1

7
22mo
Solved
Join the chat
Jan 06, 2022 (22 months ago)
Digamber
Photo of md5-a0246423746b3b51425d05cfd9c494ae
Digamber
09:40 AM
Hey Guys,
I’m trying to get a list of results (data structure not set in stone at the moment(
I’d like to have something like Brand Partners results show up first - then return other results
So for example the listing could be the same thing
Tesla - by Brand Partner
Tesla - by Anonymous User

Would like to get Tesla - by Brand Partner show up first before Anonymous user.
What would be the best way of achieving this
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
09:41 AM
Are Tesla and Brand Partner separate fields?
Digamber
Photo of md5-a0246423746b3b51425d05cfd9c494ae
Digamber
10:01 AM
Yes tesla would be the title
and Brand Parnter would be a boolean flag
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
10:10 AM
You can do sort_by=brand_partner:desc,_text_match:desc
Digamber
Photo of md5-a0246423746b3b51425d05cfd9c494ae
Digamber
10:20 AM
so brand_partner would have to be integer ?
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
10:21 AM
No, sorting on boolean is allowed.
Digamber
Photo of md5-a0246423746b3b51425d05cfd9c494ae
Digamber
10:21 AM
Great - i will test this out, thanks,

1