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

  • Home
  • SEARCH
  • 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 4020540
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T10:14:27+00:00 2026-05-20T10:14:27+00:00

Assume the following models: class Order < ActiveRecord::Base belongs_to :customer has_many :line_items, :dependent =>

  • 0

Assume the following models:

class Order < ActiveRecord::Base  
  belongs_to :customer 
  has_many   :line_items, :dependent => :destroy  
  has_many   :tickets, :through => :line_items, :dependent => :destroy  
end  

class Ticket < ActiveRecord::Base
  has_many :items, :dependent => :destroy
  has_many :services, :through => :items
  has_many :line_items
  has_many :orders, :through => :line_items
  belongs_to :technician  
end  

class Technician < ActiveRecord::Base  
  has_many :tickets
  has_many :items, :through => :tickets
  accepts_nested_attributes_for :tickets, :items
end  

How do you index this in thinking_sphinx

Order.tickets.first.technician.name

I understand that I could do

  define_index do
    indexes tickets.technician_name, :as => :technician_name
  end 

if technician_name is a column in tickets table, but it’s not. tickets table only has foreign keys.

  • 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. Editorial Team
    Editorial Team
    2026-05-20T10:14:28+00:00Added an answer on May 20, 2026 at 10:14 am

    According to the documentation of the indexes method:

    http://rdoc.info/github/freelancing-god/thinking-sphinx/master/ThinkingSphinx/Index/Builder#indexes-instance_method

    You should be able to navigate through associations like:

     define_index do
         indexes tickets.technician.name, :as => :technician_name
     end 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Assume the following: models.py class Entry(models.Model): title = models.CharField(max_length=50) slug = models.CharField(max_length=50, unique=True) body
Lets assume I had the following Model class A(Models.model): def __init__(self,data): B(a=self,data=data).save() class B(Models.model):
Assume the following class: public class MyEnum: IEnumerator { private List<SomeObject> _myList = new
Assume the following type definitions: public interface IFoo<T> : IBar<T> {} public class Foo<T>
Let's assume we've got the following Java code: public class Maintainer { private Map<Enum,
Assume the following code: using (SqlConnection conn = new SqlConnection(connectionString)) { ... using (SqlCommand
When writing GUIs, I've frequently come over the following problem: Assume you have a
Assume a table with the following columns: pri_id , item_id , comment , date
Assume you are doing something like the following List<string> myitems = new List<string> {
Assume your .NET-based development team is already using the following set of tools in

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.