Displaying 20 results from an estimated 33 matches for "sortfield".
Did you mean:
sort_field
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?
thanks very much.
regards
caspar
--
Posted via http://www.ruby-forum.com/.
2005 Dec 16
5
Ordering results by something other than relevance
Along with the contents of the documents in my index, I have stored
the date they were added. I want to search for keywords in the index
but have the results be sorted by their date rather than their
relevance to the keywords. How would I do this in ferret?
Thanks,
Carl
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...
2008 Mar 01
3
Possible bug when creating a Ferret::Search::Sort object?
...ate a Sort object using the default fields (SCORE and
DOC_ID), but setting reverse to true.
Here''s the minimal example:
#!/usr/bin/env ruby
require ''rubygems''
require ''ferret''
Ferret::Search::Sort.new
Ferret::Search::Sort.new(
[
Ferret::Search::SortField::SCORE,
Ferret::Search::SortField::DOC_ID
],
false
)
Ferret::Search::Sort.new(
[
Ferret::Search::SortField::SCORE_REV,
Ferret::Search::SortField::DOC_ID_REV
],
false
)
Ferret::Search::Sort.new(
[
Ferret::Search::SortField::SCORE,
Ferret::Search::SortField::DOC_ID...
2007 Mar 31
3
Sorting issues, can anyone help me?
...end
end
def posted_at_sort
begin
return self.posted_at.to_i
rescue
return nil
end
end
end
But when I try to sort by :rank_sort or :posted_at_sort it didn''t work,
see:
>> h,r = Post.full_text_search("voltamos", {:sort => Ferret::Search::SortField.new(:rank_sort, :reverse => false)} )[1].first.posted_at_sort
=> [1146857920]
>> h,r = Post.full_text_search("voltamos", {:sort => Ferret::Search::SortField.new(:rank_sort, :reverse => false)} )[1].last.posted_at_sort
=> [1085549830]
>> h,r = Post.full_text_sear...
2007 Sep 07
4
Ferret DRB - can add/edit index, but can''t search
...unning this application on my local development
environment... and I had no problems running in this hosting environment
before I started using Ferret DRB.
Here are some example sorts and/or filters I''m using in my searches (not
sure if this matters to Ferret DRB or not):
Ferret::Search::SortField.new(:article_published_date, :reverse => true)
Ferret::Search::Sort.new([Ferret::Search::SortField::SCORE, date_sort])
Ferret::Search::RangeQuery.new(:article_published_date, :>= =>
UserSystem::APP_DEFAULTS[:days_for_new].days.ago.utc.to_i.to_s, :<= =>
Time.now.utc.to_i.to_s)
Ferr...
2007 May 22
1
Bug in Ferret::Search::SortField::SCORE ??
i have been trying to get this to work for a while now. my controller
is
sort = [ Ferret::Search::SortField::SCORE_REV ]
@results = Record.multi_search(params[:search_terms], [ Link, Post,
Event ], {:limit => :all, :sort => sort })
and in my view i just render a conglomeration of the appropriate
partials for each model. it seems that no matter what i do, i can''t get
the results to be o...
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 May 05
3
Sorting by score
I''m trying to sort by score but it seems like SortField::SortType::SCORE
is 0 instead of a SortType. A test case is attached. Without the C
extensions the test passes, so I guess it''s a bug in them. Should I be
using it without the extensions? Because if that''s the case I have some
other bugs to report.
Greetings,
Pedro C?rte-Real
--...
2006 Aug 30
7
AAF Sorting by date - what am I doing wrong?
...ort 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)
Comment.find_by_contents("test", :sort => sort_fields, :num_docs => 5)
This also doesn''t affect the order:
Comment.find_by_contents("test", :sort => ["ferret_created_at"],
:num_docs => 5)
T...
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 Aug 20
1
sorting with booleans
...g 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 is the relevent code that i''m currently using.
sort_fields = []
sort_fields << Ferret::Search::SortField.new("sponsorerd")
sort_fields << Ferret::Search::SortField.new("ferret_date_registered",
:reverse => :true)
results = VoObject.find_by_contents(query,:first_doc=>page, :num_docs=>
20,:sort =>sort_fields)
Thanks in advance for any replies.
regards
c
--
Po...
2006 Oct 02
4
Another web app using Ferret
...e called Studicious
(http://stu.dicio.us). We have been using Ferret from the beginning, and
recently added acts_as_ferret and sorting to the system.
As you can see if you try the search, sorting is not working as
expected. I am using this code (w/ find_by_content):
:sort => Ferret::Search::SortField.new(:school_sort, :reverse => false)
:school_sort is an untokenized field with otherwise default settings.
Any ideas?
- Winton
--
Posted via http://www.ruby-forum.com/.
2007 Apr 01
2
strange behavior after switching to DRb server
...encing strange behavior
when sorting on score. My app was working as expected before the switch.
Both before and after the switch, my app sorts properly on other
fields, such as date.
For sorting on score, I am using the following option
find_by_contents option:
:sort => Ferret::Search::SortField::SCORE
Before switching to DRb, this worked very well. Afterward, I see the
error below. (Resource is my model).
Any ideas?
Thanks (again...)
John
---------------------------
RuntimeError in Resource searchController#index
invalid value: <SCORE>
RAILS_ROOT: script/../config/..
(dru...
2006 Dec 28
13
Sorting/Ordering Search Results
...; 1}
options = default_options.merge options
options[:offset] = options[:limit] * (options.delete(:page).to_i-1)
results = Member.find_by_contents(q, options, find_options)
return [results.total_hits, results]
end
(controller)
sortable_fields = []
sortable_fields << Ferret::Search::SortField.new(''company_name'')
@total, @members = Member.full_text_search("Restaurants", {:page =>
(params[:page]||1), :sort => sortable_fields}, {:include =>
[:categories, :discounts], :order => ["members.company_name ASC"]})
--
Posted via http://www.ruby-...
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 =
2006 Jul 04
3
Recalculating the score
Hey ..
I''m using ferret to index various objects and i''m create a
Ferret::Document for each of these objects. Indexing and searching is
working fine.
Each of these Ferret::Documents has a ''relevance'' field, storing an
integer, how relevant this object is for the search. The ''relevance'' is
in the range of 1..10
Now i would like to
2007 Apr 01
7
baffling sort problem
I had sort-by-date working almost perfectly with my app. It was
behaving as expected for most data, but had a few hiccups with
certain data. I investigated and discovered that the correct data was
storing this in my ferret index: "1999-10-18 00:00:00" and the
incorrect data was storing this: "Mon Oct 18 00:00:00 EDT
1999" (oops...)
So I of course had to fix the
2006 Jun 25
1
Sorting ferret 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 form. I
2007 Jul 09
2
Problems with sorting of search results
...w
Living together > Family > Marriage > Wife
Language and Communication > Language > Language Family > Finnish
Now i want the results to be sorted by that
hierarchy field, but it seems to be sorted
randomly .. i tried both :sort => "hierarchy"
as well as
:sort => SortField.new(:hierarchy, :type => :string)
i get differently sorted results, using the SortField
or the string parameter, but neither are in the
correct order. As i said, the sorting on my local
development machine is fine, it''s sorted the
way i would expect it ..
I use ferret 0.11.4 with rub...