If I understood your question correctly, that's what I am suggesting to try.
Notice that, as I mentioned earlier, that ignores all the complexity of similarity, ranking, etc that Solr offers. But it does not seem you need it in your particular case, as you are just searching for presence/absence of terms. Regards, Alex. ---- Solr Analyzers, Tokenizers, Filters, URPs and even a newsletter: http://www.solr-start.com/ On 15 August 2015 at 00:08, Brian Narsi <bnars...@gmail.com> wrote: > I see, so basically I add another field to the schema "CustomScore" and > assign score to it based on values in other fields. And then just order by > it. > > Is that right? > > On Fri, Aug 14, 2015 at 10:58 PM, Alexandre Rafalovitch <arafa...@gmail.com> > wrote: > >> Clarification: In the client that is doing the _indexing_/sending data >> to Solr. Not the one doing the querying. >> >> And custom URP if you can't change the client and need to inject that >> extra code on the Solr side. >> >> Sorry, for extra emails. >> >> Regards, >> Alex. >> ---- >> Solr Analyzers, Tokenizers, Filters, URPs and even a newsletter: >> http://www.solr-start.com/ >> >> >> On 14 August 2015 at 23:57, Alexandre Rafalovitch <arafa...@gmail.com> >> wrote: >> > My suggestion was to do the mapping in the client, before you hit >> > Solr. Or in a custom UpdateRequestProcessor. Because only your client >> > app knows the order you want those things in. It certainly was not any >> > kind of alphabetical. >> > >> > Then, you just sort by that field and Solr would not care about the >> > complicated rules. Faster that way too, as the mapping only happens >> > once when the document is indexed. >> > >> > Regards, >> > Alex. >> > ---- >> > Solr Analyzers, Tokenizers, Filters, URPs and even a newsletter: >> > http://www.solr-start.com/ >> > >> > >> > On 14 August 2015 at 23:52, Brian Narsi <bnars...@gmail.com> wrote: >> >> Search term is searched in Description. >> >> >> >> The search string is relevant in the context that the Description of >> >> returned records must contain the search string. But when several >> records >> >> Description contains the search string then they must be ordered >> according >> >> to the values in Code and Prefer. >> >> >> >> I understand what you are saying about mapping Code to numbers. But can >> you >> >> help with some examples of actual solr queries on how to do this? >> >> >> >> Thanks >> >> >> >> On Fri, Aug 14, 2015 at 2:46 PM, Alexandre Rafalovitch < >> arafa...@gmail.com> >> >> wrote: >> >> >> >>> 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 <bnars...@gmail.com> 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! >> >>> >>