Sorry for not responding sooner - I’ve been a bit behind on my inbox for the past few weeks.
There’s nothing obviously wrong in your index definition. You don’t seem to have any multi-value attributes, which is where indexing complexity can grow dramatically. The SQL you’re running seems quite simple - two joins (letsgos and location), so provided there are foreign key database indices for both of those, I think we can rule out the index definition being the source. If your machine has resources to spare, what you could do is increase the indexer’s memory limit: http://sphinxsearch.com/docs/current.html#conf-mem-limit <http://sphinxsearch.com/docs/current.html#conf-mem-limit> You can do this in config/thinking_sphinx.yml for each appropriate environment: production: mem_limit: “1024M” Perhaps that’ll help? — Pat > On 23 Apr 2015, at 12:04 am, C Wilson <[email protected]> wrote: > > The error has resurfaced. I think it's an indexing error, as oppose to MYSQL > problem. Can someone take a look to see if there's a better way to setup my > index? > > Here's the index: > > ThinkingSphinx::Index.define :location, :with => :active_record do > indexes city > > has "RADIANS(locations.latitude)", :as => :latitude, :type => :float > has "RADIANS(locations.longitude)", :as => :longitude, :type => :float > end > > ThinkingSphinx::Index.define :user, :with => :active_record, :delta => true > do > indexes name, :as => :user, :sortable => true > indexes letsgos.content > indexes religion, about_me, height, career, feet, inches, sexuality, > children, user_smoke, user_drink, politics, gender, ethnicity, education, > email, zip_code > has created_at, updated_at > has "RADIANS(locations.latitude)", :as => :latitude, :type => :float > has "RADIANS(locations.longitude)", :as => :longitude, :type => :float > has(:id, :as => :user_id) > has age > has username > has birthday > set_property :wordforms => 'lib/word.txt' > join location > end > > > I modified the index so that I can display random users on my homepage. > > Searches Controller: > > def index > if current_user.present? > @search = Search.new > > if params["min_age"].present? and params[:search].present? > conditions = {} > range_cond = {} > conditions[:gender] = params["gender"].join('|') if > params["gender"].present? > conditions[:ethnicity] = > params["ethnicity"].join('|') if params["ethnicity"].present? > if params["zip_code"].present? > l = > Location.find_by_zip_code(params["zip_code"]) > lat = l.latitude * Math::PI / 180.0 > lng = l.longitude * Math::PI / 180.0 > else > lat = current_user.latitude * Math::PI / 180.0 > lng = current_user.longitude * Math::PI / 180.0 > end > conditions[:religion] = params["religion"].join('|') > if params["religion"].present? > range_cond[:age] = if params["min_age"].present? and > params["max_age"].present? > > params["min_age"].to_i..params["max_age"].to_i > elsif > params["min_age"].present? > > params["min_age"].to_i..65 > elsif > params["max_age"].present? > > 18..params["max_age"].to_i > end > range_cond[:geodist] = 0.0..100_000.0 > conditions[:children] = params["children"].join('|') > if params["children"].present? > @users = if params[:search].present? > User.search(params[:search], > :conditions => conditions, > :with > => range_cond, > :geo => > [lat, lng], > :order > => 'geodist ASC', :without => {:user_id => current_user.id} > ) > else > User.search(:conditions => > conditions, > :with > => range_cond, > :geo => > [lat, lng], > :order > => 'geodist ASC', :without => {:user_id => current_user.id} > ) > end > else > params[:search] = params[:search] || '' > @users = User.search(params[:search].gsub(/\s+/, ' | > '), > :geo => [current_user.latitude * Math::PI / > 180.0, current_user.longitude * Math::PI / 180.0], > :with => {:geodist => 0.0..100_000.0}, > :order => 'geodist ASC', :without => {:user_id > => current_user.id}) > > > end > render 'users/index', layout: 'new_application' > else > redirect_to "/signup" > end > > -- > You received this message because you are subscribed to the Google Groups > "Thinking Sphinx" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected] > <mailto:[email protected]>. > To post to this group, send email to [email protected] > <mailto:[email protected]>. > Visit this group at http://groups.google.com/group/thinking-sphinx > <http://groups.google.com/group/thinking-sphinx>. > For more options, visit https://groups.google.com/d/optout > <https://groups.google.com/d/optout>. -- You received this message because you are subscribed to the Google Groups "Thinking Sphinx" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/thinking-sphinx. For more options, visit https://groups.google.com/d/optout.
