On 5/6/06, Pedro Côrte-Real <[EMAIL PROTECTED]> wrote:
> On Fri, 2006-05-05 at 23:49 +0900, David Balmain wrote:
> > Hi Pedro,
> >
> > This isn't a bug in either. Ferret with the extensions differs
> > slightly from Ferret without the extensions. This is unfortunate but
> > it's something you'll have to live with for a while yet. I have a lot
> > of other things to work on before I get back to working on the pure
> > Ruby version of Ferret. Sorry about this.
>
> No problem, but then how do I sort by score with the extensions?
>
> Pedro.

Oh, now I see what you are asking. Just the same way as you would
without the extensions. This much is the same in both versions. The
fact that the SortTypes are integers instead of SortType objects is
just an implementation issue. Actually you should use
SortField::FIELD_SCORE. So if you wanted to sort by create_date
(stored like "20060505") and then by score you could create a sort
like this;

    date_sf = SortField.new(:create_date, {:sort_type =>
SortField::SortType::INTEGER})

    sort = Sort.new([date_sf, SortField::FIELD_SCORE])

In fact, it will work out that the field is an integer field itself so
you could just do this;

    sort = Sort.new(["create_date", SortField::FIELD_SCORE])

Hope that helps,
Dave

_______________________________________________
Ferret-talk mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/ferret-talk

Reply via email to