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

The Archive Base Latest Questions

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

I have no experience with thinking_sphinx (I take pride in the fact I even

  • 0

I have no experience with thinking_sphinx (I take pride in the fact I even got it working).

I would like to sort my results based on relevance to the search and how recent they are. Maybe, 5X for relevance, 1X for time. (I’d have to play with that to get it right). Obviously if there’s no search criteria, I’d like it to sort just by time.

I know I need to add the created_at column to the search model, but not as indexes (what term do I use?)

Report controller:

def index
  @reports = Report.search params[:search]
  # unknown sorting code here
end

Report model:

  define_index do
    indexes apparatus
    indexes body
    indexes comments.body, as => :comment_body
    ????? created_at
  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. Editorial Team
    Editorial Team
    2026-05-27T10:26:56+00:00Added an answer on May 27, 2026 at 10:26 am

    You would just do:

    define_index do
      indexes apparatus
      indexes body 
      indexes comments.body, as => :comment_body
    
      has created_at
    end
    

    By using has you just denote whatever fields it needs but isn’t indexing on

    For search sorting, you need to read the Sphinx docs for how you think you’d want them weighted and sorted:

    http://freelancing-god.github.com/ts/en/searching.html#sorting

    http://freelancing-god.github.com/ts/en/searching.html#fieldweights

    By default, Sphinx sorts based on how relevant it thinks the results are to the given inputs.

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

Sidebar

Related Questions

Anyone have experience with algorithmic trading (like stocks)? Any good services to use to
Does anyone have experience with algorithms for evaluating hypergeometric functions? I would be interested
I'm relatively new to version control, and so far only have experience working with
Anyone have experience with adding a ReSharper profile to the VS2008 solution and share
I have experience in PHP, JSP/servelts and classic ASP, and I am trying to
I have experience with OCaml. You had to write a stub for every function
Anyone have experience with this plugin? I have it installed but I have no
anyone have experience doing this? when i say imaginary i mean the square root
Does anyone have experience using the URL Rewrite Module (see here )? Can it
Does anyone have experience using makefiles for Visual Studio C++ builds (under VS 2005)

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.