hi, all

   I have an application working well with thinking sphinx. Got the
indexing cronjobs running fine and well.

Assuming a blogging application, the main class is Part and each Part
object has a status.
Statuses are represented by the 'Status' class.

+----+-----------------+---------------------+---------------------+
| id | name            | created_at          | updated_at          |
+----+-----------------+---------------------+---------------------+
|  1 | details         | 2010-03-04 12:20:12 | 2010-03-04 12:20:12 |
|  2 | fitting_profile | 2010-03-04 12:20:12 | 2010-03-05 07:02:11 |
|  3 | live            | 2010-03-04 12:20:12 | 2010-03-04 12:20:12 |
|  4 | archived            | 2010-03-04 12:20:12 | 2010-03-04 12:20:12
|
+----+-----------------+---------------------+---------------------+

I now need to have my search results:
1) ordered by the updated_at attribute. This is by using t.timestamps
in the model

2) filtered only when the status is "live". Of course, the part object
would have a status_id attribute linking to its status.


Here's what my call to thinking sphinx's search in the search
controller looks like.

      if (params[:search][:by_keyword])
        @search = Part.search(
          params[:search][:by_keyword],
          :with      => {  Status.find_by_name('live') },
          :page      => params[:page],
          :per_page  => 10,
          :order     => :updated_at,
          :sort_mode => :desc
        )


1) For some silly reason, when I do a search, I got the following
error, "NoMethodError (undefined method `>>' for #<Status:
0x2ac1fff36308>):".
    What does this mean and how do I fix it?

2) I then removed the filter for status and this is how my code looks
like.

      if (params[:search][:by_keyword])
        @search = Part.search(
          params[:search][:by_keyword],
          :page      => params[:page],
          :per_page  => 10,
          :order     => :updated_at,
          :sort_mode => :desc
        )

   When I ran a search, no results came out but if I removed
the :order and :sort_mode lines, I get results.
   What did I do wrong? The attribute, :updated_at was specified
there.


Help!


-- 
You received this message because you are subscribed to the Google Groups 
"Thinking Sphinx" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/thinking-sphinx?hl=en.

Reply via email to