SitePoint Sponsor

User Tag List

Results 1 to 1 of 1
  1. #1
    SitePoint Zealot
    Join Date
    Mar 2003
    Location
    Georgia
    Posts
    161
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How to display search results using thinking sphinx

    I have thinking sphinx setup with my search form, but it is returning all users instead of users with the data I searched.

    In the users controller:

    Code Ruby:
    def index
    @users = params[:query].blank? ? User.all : User.search(params[:query])

    user_index.rb (inside /indices):

    Code Ruby:
    ThinkingSphinx::Index.define :user, :with => :active_record do
      # fields
      indexes name, :as => :user, :sortable => true
      indexes [ethnicity, religion, about_me, sexuality, children, user_smoke, user_drink, age, gender]
     
    # attributes
      has id, created_at, updated_at
    end

    I have nothing for thinking sphinx inside my User model, not sure if I need to go that route. Any help would be appreciated
    Last edited by Mittineague; Aug 9, 2013 at 19:35. Reason: reformatting bbcode tags
    Founder and CEO of AreYouTaken.com


Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •