On Fri, Feb 09, 2007 at 06:57:56PM +0100, Andreas Korth wrote: > > On Feb 9, 2007, at 6:28 PM, jen wrote: > > > I have a field named 'title'. > > If I tokenize this field then I'm able to search it by keywords but > > not > > able to sort it. However if I untokenize so that sorting works, then > > the search fails. > > > > Its a dilemma but I'm sure there must be some solution to this > > problem, > > right? > > > > It can't be that for any particular field I have to choose between > > whether I want to search it or sort by it. > > What about > > FieldInfo.new(:title, :index => :yes, :store => yes) > > This should store the field in it's original format while indexing it > tokenized. > > If this doesn't work, I'd consider it a bug since the documentation > suggests that :store and :index are independent options. At least, it > doesn't state otherwise. Setting a certain value for :store should > not conflict or interfere with any value for :index.
:store does not interfere with the value given for :index, but as I understand the docs, storing a field's contents doesn't help with sorting either. From the docs only the :index option influences the ability to sort. Imho storing a field's content is completely independent from (un)tokenized indexing, and the sorting is done on the indexed values, not on the stored ones. > If this is indeed not working as expected, you could use two fields, > one which you store untokenized (for sorting) and one which you don't > store but index tokenized. That'd wouldn't be an elegant solution but > a feasible one. That's the common solution. There's no need to use :store => :yes for any of these fields, unless you have any use for the stored original field content. so you'd have: # the field for search FieldInfo.new(:title, :index => :yes, :store => whatever you want) # the field for sorting, leaving out any info not needed for sorting FieldInfo.new(:sortable_title, :index => :untokenized, :store => :no, :term_vector => :no) Jens -- webit! Gesellschaft für neue Medien mbH www.webit.de Dipl.-Wirtschaftsingenieur Jens Krämer [EMAIL PROTECTED] Schnorrstraße 76 Tel +49 351 46766 0 D-01069 Dresden Fax +49 351 46766 66 _______________________________________________ Ferret-talk mailing list [email protected] http://rubyforge.org/mailman/listinfo/ferret-talk

