Hi, One of the AAF features is to be able to index results of methods, but I haven''t seen anywhere how to do this. I have a method that returns the full text of a file and I''d like for this to be indexed. Can anyone out there help me out on this one? Tom -- Posted via http://www.ruby-forum.com/.
Jan Prill
2006-May-22 07:37 UTC
[Ferret-talk] how to index the result of any instance method
Hi, Tom, haven''t used this myself but if I understand http://projects.jkraemer.net/acts_as_ferret/rdoc/classes/FerretMixin/Acts/ARFerret/ClassMethods.html#M000005correctly you are able to add symbols of your instance methods to the fields of the options hash of acts_as_ferret: "fields:names all fields to include in the index. If not given, all attributes of the class will be indexed. You may also give symbols pointing to instance methods of your model here, i.e. to retrieve and index data from a related model. " Regards Jan On 5/22/06, Tom <tom.oristian at gmail.com> wrote:> > Hi, > > One of the AAF features is to be able to index results of methods, but I > haven''t seen anywhere how to do this. I have a method that returns the > full text of a file and I''d like for this to be indexed. Can anyone out > there help me out on this one? > > Tom > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Ferret-talk mailing list > Ferret-talk at rubyforge.org > http://rubyforge.org/mailman/listinfo/ferret-talk >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/ferret-talk/attachments/20060522/4621bbd0/attachment.htm
Jens Kraemer
2006-May-22 09:21 UTC
[Ferret-talk] how to index the result of any instance method
Hi! On Mon, May 22, 2006 at 09:37:54AM +0200, Jan Prill wrote:> Hi, Tom, > > haven''t used this myself but if I understand > http://projects.jkraemer.net/acts_as_ferret/rdoc/classes/FerretMixin/Acts/ARFerret/ClassMethods.html#M000005correctly > you are able to add symbols of your instance methods to the fields > of the options hash of acts_as_ferret: > > "fields:names all fields to include in the index. If not given, > > all attributes of the class will be indexed. You may also give > symbols pointing to instance methods of your model here, i.e. > to retrieve and index data from a related model. > "right, just use the method name as a symbol in the fields list: class MyModel < ActiveRecord::Base acts_as_ferret :fields => [ :full_text, ''title'' ] def full_text # return content to be indexed here end end where title is a normal database backed attribute. Cheers, Jens> On 5/22/06, Tom <tom.oristian at gmail.com> wrote: > > > >Hi, > > > >One of the AAF features is to be able to index results of methods, but I > >haven''t seen anywhere how to do this. I have a method that returns the > >full text of a file and I''d like for this to be indexed. Can anyone out > >there help me out on this one? > > > >Tom > > > >-- > >Posted via http://www.ruby-forum.com/. > >_______________________________________________ > >Ferret-talk mailing list > >Ferret-talk at rubyforge.org > >http://rubyforge.org/mailman/listinfo/ferret-talk > >> _______________________________________________ > Ferret-talk mailing list > Ferret-talk at rubyforge.org > http://rubyforge.org/mailman/listinfo/ferret-talk-- webit! Gesellschaft f?r neue Medien mbH www.webit.de Dipl.-Wirtschaftsingenieur Jens Kr?mer kraemer at webit.de Schnorrstra?e 76 Tel +49 351 46766 0 D-01069 Dresden Fax +49 351 46766 66
Jens Kraemer wrote:> Hi! > > On Mon, May 22, 2006 at 09:37:54AM +0200, Jan Prill wrote: >> symbols pointing to instance methods of your model here, i.e. >> to retrieve and index data from a related model. >> " > > right, just use the method name as a symbol in the fields list: > > class MyModel < ActiveRecord::Base > acts_as_ferret :fields => [ :full_text, ''title'' ] > def full_text > # return content to be indexed here > end > end > > where title is a normal database backed attribute. > > Cheers, > Jens > > >> > >> >-- >> >Posted via http://www.ruby-forum.com/. >> >_______________________________________________ >> >Ferret-talk mailing list >> >Ferret-talk at rubyforge.org >> >http://rubyforge.org/mailman/listinfo/ferret-talk >> > > >> _______________________________________________ >> Ferret-talk mailing list >> Ferret-talk at rubyforge.org >> http://rubyforge.org/mailman/listinfo/ferret-talk > > -- > webit! Gesellschaft f?r neue Medien mbH www.webit.de > Dipl.-Wirtschaftsingenieur Jens Kr?mer kraemer at webit.de > Schnorrstra?e 76 Tel +49 351 46766 0 > D-01069 Dresden Fax +49 351 46766 66Thanks Jens, Now I''ve got the approach figured out, but I seem to be having problems yet. It seems that my full_text method is not actually being indexed. In fact, I''ve placed a breakpoint inside the method and it seems that it''s never even being called. Meanwhile, Ferret still manages to update index with every new instance of MyModel, but without the full_text value. I also placed a breakpoint in vendor/plugins/acts_as_ferret/rebuild_index.rb and it appears that IT is never called when a new model instance is created. Any thoughts? Really appreciate your help, Tom -- Posted via http://www.ruby-forum.com/.
Jens Kraemer
2006-May-23 07:40 UTC
[Ferret-talk] how to index the result of any instance method
On Tue, May 23, 2006 at 08:42:10AM +0200, Tom wrote:> Jens Kraemer wrote: > > Hi! > > > > On Mon, May 22, 2006 at 09:37:54AM +0200, Jan Prill wrote: > >> symbols pointing to instance methods of your model here, i.e. > >> to retrieve and index data from a related model. > >> " > > > > right, just use the method name as a symbol in the fields list: > > > > class MyModel < ActiveRecord::Base > > acts_as_ferret :fields => [ :full_text, ''title'' ] > > def full_text > > # return content to be indexed here > > end > > end > > > > where title is a normal database backed attribute. > > > > Thanks Jens, > > Now I''ve got the approach figured out, but I seem to be having problems > yet. It seems that my full_text method is not actually being indexed. > In fact, I''ve placed a breakpoint inside the method and it seems that > it''s never even being called. Meanwhile, Ferret still manages to update > index with every new instance of MyModel, but without the full_text > value. I also placed a breakpoint in > vendor/plugins/acts_as_ferret/rebuild_index.rb and it appears that IT is > never called when a new model instance is created. Any thoughts?What version of acts_as_ferret do you use ? Could you try to upgrade from svn ? rebuild_index.rb has been removed some time ago as it is obsolete. Jens -- webit! Gesellschaft f?r neue Medien mbH www.webit.de Dipl.-Wirtschaftsingenieur Jens Kr?mer kraemer at webit.de Schnorrstra?e 76 Tel +49 351 46766 0 D-01069 Dresden Fax +49 351 46766 66
Jens Kraemer wrote:> On Tue, May 23, 2006 at 08:42:10AM +0200, Tom wrote: >> > class MyModel < ActiveRecord::Base >> >> Now I''ve got the approach figured out, but I seem to be having problems >> yet. It seems that my full_text method is not actually being indexed. >> In fact, I''ve placed a breakpoint inside the method and it seems that >> it''s never even being called. Meanwhile, Ferret still manages to update >> index with every new instance of MyModel, but without the full_text >> value. I also placed a breakpoint in >> vendor/plugins/acts_as_ferret/rebuild_index.rb and it appears that IT is >> never called when a new model instance is created. Any thoughts? > > What version of acts_as_ferret do you use ? Could you try to upgrade > from svn ? rebuild_index.rb has been removed some time ago as it is > obsolete. > > Jens > > -- > webit! Gesellschaft f?r neue Medien mbH www.webit.de > Dipl.-Wirtschaftsingenieur Jens Kr?mer kraemer at webit.de > Schnorrstra?e 76 Tel +49 351 46766 0 > D-01069 Dresden Fax +49 351 46766 66Okay, thanks. I''ve got it working now for simple text files. Can anybody share any experience/opinion they have on using Ruby to process and index/search Microsoft documents and PDFs ??? Thanks for any help. -- Posted via http://www.ruby-forum.com/.
Jens Kraemer
2006-Jun-01 08:24 UTC
[Ferret-talk] how to index the result of any instance method
On Thu, Jun 01, 2006 at 09:35:18AM +0200, Tom On wrote:> > Okay, thanks. I''ve got it working now for simple text files. Can > anybody share any experience/opinion they have on using Ruby to process > and index/search Microsoft documents and PDFs ??? Thanks for any help.In RDig I use the wvText and pdftotext to extract textual content from word and pdf documents. Imho there is no Ruby lib yet to do this. Jens -- webit! Gesellschaft f?r neue Medien mbH www.webit.de Dipl.-Wirtschaftsingenieur Jens Kr?mer kraemer at webit.de Schnorrstra?e 76 Tel +49 351 46766 0 D-01069 Dresden Fax +49 351 46766 66
David Balmain
2006-Jun-01 08:38 UTC
[Ferret-talk] how to index the result of any instance method
On 6/1/06, Jens Kraemer <kraemer at webit.de> wrote:> On Thu, Jun 01, 2006 at 09:35:18AM +0200, Tom On wrote: > > > > Okay, thanks. I''ve got it working now for simple text files. Can > > anybody share any experience/opinion they have on using Ruby to process > > and index/search Microsoft documents and PDFs ??? Thanks for any help. > > In RDig I use the wvText and pdftotext to extract textual content from word > and pdf documents. Imho there is no Ruby lib yet to do this.I second that. I''ve tried the Ruby pdf reader alternitives on RAA without much luck. If anyone knows a good pdf reading opensource C library I''d be happy to write some bindings. But I think wvText and pdftotext are your best options right now.