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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T05:47:53+00:00 2026-05-28T05:47:53+00:00

My model is indexed with Thinking Sphinx and I am wanting to filter search

  • 0

My model is indexed with Thinking Sphinx and I am wanting to filter search results by the model’s tags—provided by acts_as_taggable_on. I read this previous question, which enabled my searches to use :conditions => { :tags => 'Comedy' } as a filtering query.

This is not a catch-all solution, since by default all text is searched in Sphinx’s indexed fields. For example, when I search Model.search :conditions => { :tags => "Comedy" }, results with the tag Black Comedy also appear. I see that using attributes instead of fields is a solution, but I cannot seem to get valid results when searching Model.search :with => { :tags => "Comedy" } and my define_index block looks like this:

define_index
   indexes title, :sortable => true
   has category_tags(:name), :as => :tags
end

Note that I am building upon the previous answer provided in the question linked above. The answerer details indexing tags within context—thus the reason for the category_tags method.

  • 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-28T05:47:54+00:00Added an answer on May 28, 2026 at 5:47 am

    Change your index to:

    define_index
      indexes title, :sortable => true
      has "CRC32(category_tags.name)", :as => :tags, :type => integer
    end
    

    Note: category_tags.name refers to your_table_name.column_name

    And search the tag after converting to int:

    Model.search :with => {:tags =>'Comedy'.to_crc32}
    

    See common questions for more: http://freelancing-god.github.com/ts/en/common_issues.html

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Technique model which belongs_to User and is indexed by Thinking Sphinx.
I am using Sphinx with the Thinking Sphinx plugin. I have indexed a model
I've been reading up on the Sphinx search engine and the Thinking Sphinx gem.
I have successfully got Thinking Sphinx working with Geolocation on an associated model. Happy
a model with a uniquely indexed column Does this mean just a model and
I installed Sphinx and Thinking Sphinx for ruby on rails 2.3.2. When I search
My model will have logic that uses Date.current like this: if(date_three && date_three !=
Started using thinking sphinx today and I'd like to know what's going wrong here:
I just installed Sphinx (distro: archlinux) downloading the source. Then I installed Thinking Sphinx
I have Sphinx and Thinking Sphinx 2.0.5 installed on my application and when I

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.