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 7655375
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T12:30:00+00:00 2026-05-31T12:30:00+00:00

Hello!,I am confused with the thinking_sphinx index I have some models,there are Bill ,

  • 0

Hello!,I am confused with the thinking_sphinx index

I have some models,there are Bill ,LineItem and product

Bill has_many :line_items
LineItem has_one  :product

the Product have two attributes: number and name

example:

bill.line_items.first.product.number = "product" 

I want to find the this bill with the key word "product"

how to define the index?

Thanks!

ps:Hope you can understand me,my English is poor.

  • 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-31T12:30:02+00:00Added an answer on May 31, 2026 at 12:30 pm

    Place this in Bill model:

    define_index do
      indexes line_items.product(:name)
      indexes line_items.product(:number)
    end
    

    Now you can search like this:

    Bill.search('some product name')
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hello all I have a simple Spring application which will not end as there
This has always confused me. It seems like this would be nicer: ["Hello", "world"].join("-")
I'm a newbie to Java and I'm confused about something: In the simple hello
Hello I have the following error by git-fsck, which cannot be cleaned by git-gc
Hello I am new to asp.net. I am confused what is the difference between
Hello have only a few days with Java and android here. I am a
Hello I have a problem with fetching required rows from MySQL table correctly within
Original Question Hello All, I'm a bit confused on how MVC maps HTTP requests
bitNot = (sbyte)(~bitNot) VS. myInt = Int32.Parse(myInput); Hello, I'm a bit confused on the
Hello I am having syntax issues here completely confused on how to properly do

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.