Does a config directory exist? And what's the full output of the ts:conf rake task?
-- Pat On 08/09/2011, at 10:05 PM, mikeee wrote: > Thanks Pat - RACK_ENV fixed the environment issue. > > I think the last remaining setup issue is that the ts:config rake task > doesn't generate a sphinx.yml file. I'm using TS 2.0.7, Riddle > 1.4.0, Sphinx 2.0.1, ActiveRecord 3.1.0 > > Any ideas? I think thats the reason maybe that the indexer is always > showing as blank? > > Thanks again for your help. > > > On Sep 7, 11:14 pm, Pat Allan <[email protected]> wrote: >> I think Sinatra gets its environment from RACK_ENV, but I'm not sure. Maybe >> it's worth setting the environment yourself? >> >> Also, in your app's code, may want to try requiring >> 'thinking_sphinx/sinatra' instead of 'thinking_sphinx'. >> >> -- >> Pat >> >> On 08/09/2011, at 1:12 PM, mikeee wrote: >> >> >> >> >> >> >> >>> Hi Pat - >> >>> I have TS 2.0.7 and AR 3.1.0 and Sphinx 2.0.1beta >> >>> BTW, I have my Rakefile looking like this now which is helping to some >>> extent: >> >>> require 'thinking_sphinx' >>> require 'thinking_sphinx/tasks' >> >>> require 'active_support/core_ext/string' >> >>> Sinatra::Application.root = File.dirname(__FILE__) >>> Sinatra::Application.environment = "development" >> >>> I had to require the active_support stuff in order to use the camelize >>> and blank? methods that are called down in the TS library. >> >>> What I can't figure out is why the environment is always blank once it >>> gets down into the library. I ended up playing around down in lib/ >>> thinking-sphinx/configuration.rb >> >>> Note that elsif defined?(Sinatra) is true so it drops down into the >>> puts "GOT HERE" i added but Sinatra::Application.environment.to_s is >>> an empty string. Can't figure that out yet so I just hardcoded the >>> return statement in order to get the config/development.sphinx.conf >>> file generated -otherwise it generates a file named >>> config/.sphinx.conf >> >>> def self.environment >>> return "development" >>> @@environment ||= if defined?(Merb) >>> Merb.environment >>> elsif defined?(Rails) >>> Rails.env >>> elsif defined?(Sinatra) >>> puts "GOT HERE: #{Sinatra::Application.environment.to_s}" >>> Sinatra::Application.environment.to_s >>> else >>> ENV['RAILS_ENV'] || 'development' >>> end >>> end >> >>> This is where I am currently as far as getting the files to generate: >> >>> macbook:autocomplete mengelhart$ rake ts:index >>> /Users/mengelhart/Development/sandbox/autocomplete/config/sphinx.yml >>> Generating Configuration to /Users/mengelhart/Development/sandbox/ >>> autocomplete/config/development.sphinx.conf >>> Sphinx 2.0.1-beta (r2792) >>> Copyright (c) 2001-2011, Andrew Aksyonoff >>> Copyright (c) 2008-2011, Sphinx Technologies Inc (http:// >>> sphinxsearch.com) >> >>> using config file '/Users/mengelhart/Development/sandbox/autocomplete/ >>> config/development.sphinx.conf'... >>> FATAL: no indexes found in config file '/Users/mengelhart/Development/ >>> sandbox/autocomplete/config/development.sphinx.conf' >> >>> The generated development.sphinx.conf file looks like: >> >>> indexer >>> { >>> } >> >>> searchd >>> { >>> listen = 127.0.0.1:9312 >>> log = /Users/mengelhart/Development/sandbox/autocomplete/log/ >>> searchd.log >>> query_log = /Users/mengelhart/Development/sandbox/autocomplete/log/ >>> searchd.query.log >>> pid_file = /Users/mengelhart/Development/sandbox/autocomplete/log/ >>> searchd.development.pid >>> } >> >>> My current theory is that somehow since this isn't an actual Rails app >>> that somehow TS doesn't know how to grab the AR connection to the >>> database? >> >>> Here's the single model I'm testing: >> >>> require 'thinking-sphinx' >> >>> class Location < ActiveRecord::Base >> >>> define_index do >>> indexes name >>> end >> >>> end >> >>> Any thoughts? >> >>> On Sep 7, 7:27 pm, Pat Allan <[email protected]> wrote: >>>> Hi Mike >> >>>> Which versions of Thinking Sphinx and ActiveRecord are you using? >> >>>> -- >>>> Pat >> >>>> On 08/09/2011, at 7:56 AM, mikeee wrote: >> >>>>> I'm pretty sure after doing some more digging that the issue is that >>>>> RAILS_ROOT Is not defined anywhere in a Sinatra application. I just >>>>> tried putting a RAILS_ROOT constant into my Rakefile but that isn't >>>>> helping. >> >>>>> Let me know if anyone has any experience using TS and Sinatra. >>>>> Thanks! >> >>>>> On Sep 7, 8:05 am, mikeee <[email protected]> wrote: >>>>>> Hi - >> >>>>>> I found a gist on github regarding how to get Thinking Sphinx to work >>>>>> in a sinatra app using ActiveRecord and that seems like it will work >>>>>> but I'm having trouble setting up the application in order to allow me >>>>>> to run the rake tasks necessary to generate the required configuration >>>>>> files and the index. >> >>>>>> What appears to be happening when I try and run these tasks is that it >>>>>> seems like the rake task is trying to use a path of "/" for all the >>>>>> tasks. Here's the output I get when running ts:config >> >>>>>> macbook:autocomplete mengelhart$ rake ts:config >>>>>> Generating Configuration to /config/development.sphinx.conf >>>>>> rake aborted! >>>>>> No such file or directory - /config/development.sphinx.conf >> >>>>>> Tasks: TOP => ts:config => thinking_sphinx:configure >>>>>> (See full trace by running task with --trace) >> >>>>>> Note the /config/ path that it's trying to use. Maybe I'm not >>>>>> understanding the output correctly though. >> >>>>>> I have my model in app/models in my sinatra application directory as >>>>>> well and i can hit the database and do straight up AR calls in the >>>>>> sinatra handlers I just can't seem to get the TS setup configured >>>>>> appropriately so I can index the model. >> >>>>>> Thanks for any help >> >>>>> -- >>>>> 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 >>>>> athttp://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 >>> athttp://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. > -- 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.
