What's the search string? Or is the search string irrelevant and
that's just your compulsory ordering.
Assuming anything that searches has to be returned and has to fit into
that order, I would frankly just map your special codes all together
to some sort of 'sort order' number.
So, Code=>C = 4000, Code =>B=3000. Prefer=true=>100, Prefer=false=>0.
Then, sum it up. Or some such.
Remember that fuzzy search will match even things with low probability
so a fixed sort will bring low-probability matches on top. So, either
hard non-fuzzy searches or you need to look at different solutions,
such as buckets and top-n items within those.
Regards,
Alex.
----
Solr Analyzers, Tokenizers, Filters, URPs and even a newsletter:
http://www.solr-start.com/
On 14 August 2015 at 15:10, Brian Narsi <[email protected]> wrote:
> In my documents there are several fields, but for example say there are
> three fields:
>
> Description - text - this variable text
> Code - string - always a single character
> Prefer - boolean
>
> User searches on Description.
>
> When returning results I have to order results as following:
>
> Code = C
> Code = B
> Code = S
> Code = N
> Prefer = true and Code is NULL
> Prefer = false and Code is NULL
> Prefer is NULL and Code is NULL
>
> How can this be achieved?
>
> Thanks in advance!