I''m trying to sort by score but it seems like SortField::SortType::SCORE is 0 instead of a SortType. A test case is attached. Without the C extensions the test passes, so I guess it''s a bug in them. Should I be using it without the extensions? Because if that''s the case I have some other bugs to report. Greetings, Pedro C?rte-Real -------------- next part -------------- A non-text attachment was scrubbed... Name: ferret_sort_field.rb Type: application/x-ruby Size: 218 bytes Desc: not available Url : http://rubyforge.org/pipermail/ferret-talk/attachments/20060505/1a7a08c6/attachment.bin
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. Dave On 5/5/06, Pedro C?rte-Real <Pedro.CorteReal at iantt.pt> wrote:> I''m trying to sort by score but it seems like SortField::SortType::SCORE > is 0 instead of a SortType. A test case is attached. Without the C > extensions the test passes, so I guess it''s a bug in them. Should I be > using it without the extensions? Because if that''s the case I have some > other bugs to report. > > Greetings, > > Pedro C?rte-Real > > > _______________________________________________ > Ferret-talk mailing list > Ferret-talk at rubyforge.org > http://rubyforge.org/mailman/listinfo/ferret-talk > > >
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.
On 5/6/06, Pedro C?rte-Real <Pedro.CorteReal at iantt.pt> 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