Sorting applies to the entire result set,
there's no notion of "sort some docs one
way and sort others another way". So
I don't know any OOB way to do what
you want.

I don't know what your response time
requirements are, but you could do this
by firing off two queries and collating
the results. If the performance is
acceptable, it would be faster to code
than writing a custom plugin, which would
probably do much the same thing anyway.

The second query wouldn't have to fire
if the first one returned a page full of results...

FWIW,
Erick

On Wed, Mar 19, 2014 at 6:05 AM, Rok Rejc <rokrej...@gmail.com> wrote:
> Hi all,
>
> I have a field in the index - lets call it Name. Name can have one or more
> words. I want to query all documents which match by name (full or partial
> match), and order the results:
> - first display result(s) with exact matches
> - after that display results with partial matched and order them
> alphabeticaly
>
> To achive this I have created two Name fields in the index:
> - NameUnTokenized which uses KeywordTokenizer and
> - NameTokenized which uses StandardTokenizer
>
> But now I have no clue how to write a query. Is this possible with standard
> query and sort functions?  How?
>
> Other option is to write a custom plugin which will perform two queries and
> merge results (that shouldn't be a problem).
>
> Many thanks in advance.

Reply via email to