Hi Haris When using Thinking Sphinx, Sphinx only queries via SQL - so there's no way to access model methods, only columns (and columns from associations). So, in short, there's no easy way to do what you want. If you don't want to store this data in the database, then Sphinx is probably not the best solution for you. Perhaps Solr or Xapian?
Sphinx also supports XML sources, but TS doesn't have hooks for those. http://sphinxsearch.com/docs/manual-0.9.9.html#xmlpipe2 Sorry I don't have an easy fix. -- Pat On 06/06/2010, at 5:24 AM, Haris Khan wrote: > I'm using Sphinx 0.9.9 (r2117) and ThinkingSphinx v 1.3.17 > > Sorry If this was posted elsewhere, but I did a rudimentary search and > was unable to find anything. I'm coming from acts_as_ferret and I was > able to do something along the lines of : > > acts_as_ferret :additional_fields => { :current_revision_text => > {:store => :yes}} whereby :current_revision_text was actually a method > in the model as such: > > > def current_revision_text > revision = self.current_revision > revision.text > end > > current_revision() looks like this: > > def current_revision > Revision.find(:first, :conditions => {:document_id => self.id}) > end > > .text was another method call which just grabbed the contexts of a > text based uploaded file (html,txt,pdf,doc ect..).. Not from the > database, but actually grabbed the file and processed its contents a > la: > > def text > tempfile = Tempfile.new(self.upload_file_name) > tempfile.write(self.upload.file_contents) > > result = case self.upload_content_type > when "application/msword" then `catdoc -w #{tempfile.path}` > when "application/pdf" then `pdftotext #{tempfile.path} -` > when "application/vnd.ms-excel" then `xls2cvs #{tempfile.path}` > when "application/vnd.ms-powerpoint" then `catppt > #{tempfile.path}` > when "image/jpeg" then `jhead -c #{tempfile.path}` > when "image/png" then `jhead -c #{tempfile.path}` > else "" > end > result.gsub(tempfile.path,"") > end > > > > Now I tried to do something like: > > indexes current_revision_text > > Sadly this did not work, I tried a great deal many combinations and > none did work unfortunately. I could store the text in the database, > but that is something I rather avoid. > > Any insight on the matter would be greatly appreciated. > > > -- > You received this message because you are subscribed to the Google Groups > "Thinking Sphinx" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/thinking-sphinx?hl=en. > -- You received this message because you are subscribed to the Google Groups "Thinking Sphinx" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/thinking-sphinx?hl=en.
