similar to: Sorting ferret results by column

Displaying 20 results from an estimated 1000 matches similar to: "Sorting ferret results by column"

2006 Jun 25
1
Using AND in :conditions queries
I have what amounts to a simple search engine running through a table using input from a form. Everything works fine when looking for "title" or "body" But, when I want to couple that with an AND statement the search still works fine, but it seems to disregard the AND statements. Code below: In the view: <%= start_form_tag :action=> "show_search" %>
2006 Jun 25
3
Sorting results by column
I have the acts_as_ferret plugin installed. Everything searches great, but I would like to limit the results (i.e. by ''end_date'') and sort them (by ''end_date''). ''end_date'' is a valid column in my "posts" table. Here''s the code I have already: @posts = Post.find_by_contents(params[:query]) params[:query] comes from a
2006 Jun 14
4
Using now() to determine what should be displayed
I''m trying to create a paginated list that will take note of the "end_date" field in my table. This is what I have: @post_pages, @posts = paginate(:posts, :per_page => 10, :order_by => ''end_date'') in the controller. And for the view: <h1>Posts ending soon</h1> <ul><% for post in @posts do %> <strong>Post Title:
2006 Jul 26
0
SQL query syntax
I need to search a specific column with an OR statement from a form, but can''t quite seem to figure out how. Right now I have: @query = request.raw_post || request.query_string @phrase = @query.sub(/ /,"% OR %") @posts = Post.find(:all, :conditions => [ ''(title LIKE :search_query OR body LIKE :search_query OR city LIKE :search_query
2006 Mar 01
2
Sorting the Result
The document describes search(query, options) sort: An array of SortFields describing how to sort the results. I have created index with two fields: ''file'' and ''content'' When I give SortField name as ''file'' while searching, it results into error. The exact command given by me: index.search_each("sleepless AND dreams", :num_docs
2006 Oct 16
10
Sorting by score
Hi I think this is a very easy question but here goes: I want to sort my results by a boolean field and then by score, I thought this would be a default configuration but apparently not. sort_fields = [] sort_fields << Ferret::Search::SortField.new(:sponsored, :reverse => :true) that is my current code, how do iu alter it so that the results are then sorted by highest score first?
2006 Jul 12
5
Reverse sorting
I am getting strange results when I reverse sort a query. I am sorting by date, but it doesn''t seem to be related to dates (I have tried just integers). I also paginate the results. Items in the result set are sometimes duplicated and the not ordered at all. When I try a non-reverse sort I don''t see duplicates and the ordering is correct. Any ideas what is going on? Thanks
2006 Aug 30
7
AAF Sorting by date - what am I doing wrong?
I''m trying to sort my search results by Date, in descending order. I''ve done quite a bit of reading through the forums here, and I''ve tried two different suggestions. This just returns results in the same order as a search without a sort: sort_fields = [] sort_fields << Ferret::Search::SortField.new("ferret_created_at",:reverse => :true)
2006 Jun 18
3
Ambiguous clause error
I''m trying to query one table to ultimately display the relate info from another table. I have 2 tables: "posts" and "numbers". I''m trying to do a query like this: @numbers = Number.find(:all, :conditions => [ ''(user_id) = :id'', {:id =>
2006 Aug 20
1
sorting with booleans
Hi i have a column in my ferret model called sponsored. It is a boolean and i want to order the results by sponsored and date registered. At the moment it is not managing to sort the booleans. I tried declaring this in my model but it seems to have had no effect. def false.<=>(o) o ? -1 : 0 end def true.<=>(o) !o ? 1 : 0 end I''m using the acts_as_ferret plugin. below
2006 Jun 29
13
find_by_contents not returning SearchResults?
The acts_as_ferret documentation says find_by_content returns an instance of SearchResults, but I see this error when I try to use the results. undefined method `total_hits'' for []:Array Here is the link to the documentation: http://projects.jkraemer.net/acts_as_ferret/rdoc/classes/FerretMixin/Acts/ARFerret/ClassMethods.html#M000010 But here is the actual code: result =
2007 Jul 13
8
More sorting problems with untokenized index
I''m having problems sorting on untokenized fields. I have one field that sorts fine, but there are others that seem to sort on a different field. Here''s the index description: acts_as_ferret :remote=>true,:fields=>{:name=>{:boost=>2},:name_for_sort=>{:index => :untokenized}, :city=>{:boost=>2}, :city_for_sort=>{:index=>:untokenized},
2006 Oct 31
5
conditional boost? friends to come up at top of search...
Hey guys, im trying to get my friends to come up at the top of the act as ferret search. I would query the whole result set first, then move my friends to the top, but the thing is, Im paginating my results and use the offset and limit parameters in the multi_search() function. Anyone know how to do this? Thanks in advance... -- Posted via http://www.ruby-forum.com/.
2006 Dec 28
13
Sorting/Ordering Search Results
Hello All, I am having an issue with AAF and sorting results of a search. Right now, I have results being split onto pages of 10. The results are being sorted alphabetically, but not across multiple pages - it''s just sorting the 10 it pulls down on each page. I noticed another post from April regarding this same issue (http://www.ruby-forum.com/topic/62993#66934) where the issue was
2006 Jul 19
4
sorting and pagination
Hello All, Okay i think I''m finally getting all of what i want out of ferret working, thanks mostly to reading this forum and also getting ALOT of questions answered, thanks alot everyone. Anyway my last ferret task is too get the results sorted by a field called date_registered and have this working with pagination. here is what i''m doing at the moment:
2006 Oct 02
6
Strange Sorting Issues
Hi there, I''m having some strange sorting stuff goign on. Here''s my search method: sort_fields = [] sort_fields << Ferret::Search::SortField.new("name", :reverse => :false) @results = Listing.find_by_contents @search_criteria, :limit => :all, :sort => sort_fields page = (params[:page] ||= 1).to_i items_per_page = 9 offset = (page - 1) *
2008 Jan 16
4
How to test if one range of dates overlaps another?
Hi all, I have a situation with a recurring billing application where I need to test if one range of dates "overlaps" another range of dates. Does anyone know a rails find or mysql select statement that will test for this? Here are the details: * Recurringcharge items have a start_date and an end_date that represent the period of time that the charges should occur. * Statement items
2006 Dec 11
1
Compute date during before_validation_on_create
Hello, - the form posted by the user have a date field - this date is begin_date, I need to compute end_date - so, added callback before_validation_on_create - in this method I do : end_date = begin_date >> 12 - unfortunately, beeing in before_validation the actual self.begin_date have not been type casted - It''s always a string - unfortunately again, I can''t put this code
2009 Aug 13
2
need technique for speeding up R dataframe individual element insertion (no deletion though)
Hi fellas, I am working on a dataframe cam and it involves comparison within the 2 columns - t1 and t2 on about 20K rows and 14 columns. ### cap = cam; # this doesn't take long. ~1 secs. for( i in 1:length(cam$end_date)) { x1=strptime(cam$end_date[i], "%d/%m/%Y"); x2=strptime(cam$end_date[i+1], "%d/%m/%Y"); t1= cam$vol[i]; t2= cam$vol[i+1];
2006 Dec 08
2
trouble using ActiveRecord classes
I''ve been trying unsuccessfully for the better part of today to write a worker that can use by ActiveRecord model classes. The bizarre thing is that worker just stops at the point accessing the database connection. An exception isn''t raising, it just dies. My worker class is below, I''ve interspersed log messages throughout to try to determine where it is dying. =====