On 22 May 2013 19:37, Rohan Thakur <rohan.i...@gmail.com> wrote:
[...]
>  this inital_boost is basically copy field of autosug but saved using
> different analysers taking whole sentence as single token and generating
> edge ngrams so that what I search on this field only term matching from
> first will match...and for any other infix term match I have autosug
> field....
>
> so now what I want from this is to show the documents returned with
> initial_boost first and then the documents with autosug field sorted with
> pop field respectively (separately) and return the result...
>
> now from your suggestion I could do this using   sort on multiple fields by
> separating them by
> commas, as described under
> http://wiki.apache.org/solr/CommonQueryParameters#sort
>
> but for that I would require 1 field having value greater(all equal say 2)
> for initial_boost field and smaller(all same say 1) for autosug field how
> can I do this? or is there some better solution..

Um, maybe it would help if you started out by explaining
what you are trying to do instead of changing the requirements
after a solution is proposed.

The above design seems faulty. If the fields have the same
values, there is no way to sort them differently. Boosts are
not guaranteed to always promote documents in the
desired manner, and will not work with sorting in any case.
You can try to kludge things together in various ways, e.g.,
* Add a prefix so that some fields always sort first, e.g.,
  prefix "aaa..." to a string field to try and ensure that it
  sorts first
* Have not tried this, but it should be possible to use a
  Solr function query with a function that sorts by the
  field name: http://wiki.apache.org/solr/FunctionQuery

As you seem to be using analysers on the fields, beware
that sorting will not work reliably on multi-valued or tokenised
fields.

You could also index different fields to different Solr cores,
fetch the results for individual fields with separate queries,
and combine them as desired. This might be the cleanest,
if not the most efficient, solution.

Regards,
Gora

Reply via email to