Hello
I need to sort a results set in a particolar way... the documents
looks like this:
{
"customer_id":28998,
"name_txt":["Equal Corp"],
"address_txt":["Austin Ring Center"],
"municipality_txt":["Austin"],
"province_txt":["Austin"],
"region_txt":["TX"],
"profile_txt":["Base"],
"visibility_weight_txt":["2"]
},
{
"customer_id":28997,
"name_txt":["Mustard Ltd"],
"address_txt":["Telegraph Road"],
"municipality_txt":["London"],
"province_txt":["London"],
"region_txt":["UK"],
"profile_txt":["Gold"],
"visibility_weight_txt":["2"]
}
I need to sort them by profile_txt value (it's a multiValue field but
actually it contains just a single value), but since the possible
values are just 5, I'd like to tokenize them for deciding in wich
order the should came.
the order should follows a simple schema:
1. profile_txt = "Gold"
2. profile_txt = "Super"
3. profile_txt = "Smart"
4. profile_txt = "Base"
5. profile_txt = "Essential"
Then an additional sort by visibility_weight_txt should be done
Is it possible to do this someway using FunctionQueries? Unfortunally
I can't modify the schema.
Thanks for reading
|