Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 103793
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T01:10:48+00:00 2026-05-11T01:10:48+00:00

I have two models indexed for searching (User and Item). I’m trying to do

  • 0

I have two models indexed for searching (User and Item). I’m trying to do a geo-search across models:

ThinkingSphinx::Search.search('keywords', :geo => [ degrees_to_radians(params[:lat].to_f), degrees_to_radians(params[:lon].to_f) ], )

But I only get an error:

Sphinx Error: index item_core,item_delta,user_core,user_delta: unknown latitude attribute ''

Searching each model individually works fine… but I’ve no idea what the problem here is. Here are the indexes:

User Index:

define_index do     indexes [:first_name, :last_name], :as => :name     indexes login     indexes email     indexes headline     indexes description     indexes business.name, :as => :business_name     indexes [addresses.street_1, addresses.street_2, addresses.city, addresses.postal_code], :as => :address      has created_at, :sortable => true     has addresses.latitude, :as => :latitude, :type => :float     has addresses.longitude, :as => :longitude, :type => :float          set_property :delta => true   end     

Item index:

define_index do     indexes title, :sortable => true     indexes description     indexes [address.street_1, address.street_2, address.city, address.postal_code], :as => :address     indexes images.title, :as => :image_titles     indexes images.description, :as => :image_descriptions     indexes categories(:name), :as => :category_names          has price, :sortable => true     has created_at, :sortable => true     has address.latitude, :as => :latitude, :type => :float     has address.longitude, :as => :longitude, :type => :float         has categories(:id), :as => :category_ids      where '`items`.`state` = 'for_sale''      set_property :delta => true       end 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T01:10:48+00:00Added an answer on May 11, 2026 at 1:10 am

    This is a late response, but better than nothing, hopefully:

    When you’re not searching on a specific model, Thinking Sphinx has no reference point for knowing what attributes are available, so you need to explicitly tell it the lat and long attributes to use:

    ThinkingSphinx::Search.search('keywords',   :geo => [     degrees_to_radians(params[:lat].to_f),     degrees_to_radians(params[:lon].to_f)   ],   :latitude_attr  => 'latitude',   :longitude_attr => 'longitude' ) 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two models: User and Car with the following associations: User has_many Car
I have two models User and Category that have a HABTM association. I would
I have two models in my Django application, for the purposes of storing search
I have two models, user and group. I also have a joining table groups_users.
I have two models Post and comment and i want to search both using
I have two models, one is Group, the other Item. A group has many
Suppose you have two models, User and City, joined by a third model CityPermission:
I have two models named message.php and user.php In message.php, I have following method
I have two models class User < ActiveRecord::Base has_many :posts searchable do text :post_titles
I have two models User and Movie.. Where those are associated with UsersWatchlist.. public

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.