Displaying 20 results from an estimated 20 matches for "first_doc".
2006 May 01
12
pagination in acts_as_ferret
I''m just wondering where I would put the pagination for search results
when using "acts_as_ferret".
At the moment my search code is..
def search
@query = params[:query] || ''''
unless @query.blank?
@results = Tutorial.find_by_contents @query
end
end
Cheers
SchmakO
--
Posted via http://www.ruby-forum.com/.
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
2007 Feb 16
1
Bug in IndexSearcher with limit => all and any offset
Here''s the deal:
static TopDocs *isea_search_w(Searcher *self,
Weight *weight,
int first_doc, // OFFSET
int num_docs, // LIMIT
Filter *filter,
Sort *sort,
filter_ft filter_func,
bool load_fields)
{
int max_size = first_doc + num_docs;
Ac...
2006 Aug 20
1
sorting with booleans
...he 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
--
Posted via http://www.ruby-forum.com/.
2006 Jul 19
4
sorting and pagination
...:Search::SortField.new("date_registered",
:reverse => :false)
results2 = VoObject.find_by_contents(query,:num_docs=> 2000000,:sort
=>sort_fields )
num = results2.size
if page == 1
page = 0
else
page = (page-1)*20
end
results = VoObject.find_by_contents(query,:first_doc=>page,
:num_docs=> 20,:sort => sort_fields)
[num,results,results2]
end
##############################
I added date_registered to the ferret fields and rebuilt the index (not
sure if this is neccessary but anyway) but my results page still shows
the results in a random order. Seems lik...
2006 Aug 02
4
Linking to the paginated items from search results.
Using Ferret for searching, I''ve got results that I need to link to.
Which is fine, except for that they''re displayed on paginated pages
using Rails paginate function - so it''s not like I can''t get it from the
database or anything else. Anyone have any ideas on how to go about
this? It''s not so much a coding problem as a theory problem, and I
2006 Jul 14
18
adding a custom filter to the query
Hi all,
I''m trying to figure out how to add a filter into a search. I''ve
created the filter, basically copying the location filter from
http://blog.tourb.us/archives/ferret-and-location-based-searches. But
when I try to call Index.search and pass the filter in a hash with the
key :filter, I get back that it is expecting type Data, and so I''m at
a loss to figure out
2005 Nov 26
3
Get number of found documents
...query).size will be effective
here. Because it returns an array of found documents. What if such documents
will be 100000?? I don''t want to select all this documents, just to know how
many found, and then select for example 10 of them
index.search_each(query, :num_docs=>PAGE_SIZE,
:first_doc=>PAGE_SIZE*(page_num-1)) do |doc_num, score|
@documents << index[doc_num]
end
So quesition is: what is the most effective way to calculate (just
calculate) number of found documents?
--
anatol (http://pomozov.info)
-------------- next part --------------
An HTML attachment was...
2006 Oct 10
2
Ferret returning too many results
...at could be causing this. any help greatly apreciated.
relevant code from our rails app:
# search_array hold an array of the model we want to search
search_array.each do |asset|
a = Object.const_get(asset)
assets << (a.find_id_by_contents q, :limit => num_docs, :offset =>
first_doc)
end
assets.flatten!
return assets
--
Posted via http://www.ruby-forum.com/.
2005 Dec 02
4
How to get the count of matching documents
I''m trying to generate a rails pagination helper for some ferret
search results, and I need to know how many total matches there are to
my search query. I don''t see an obvious way of finding this. Any
help would be appreciated.
Thanks,
Carl Youngblood
2006 Jul 05
1
search speed eclipsed by retrieval speed
...re:
ram_dir = Ferret::Store::RAMDirectory.new
index = Ferret::Index::Index.new(:dir => ram_dir, :create => true)
index.add_indexes(Ferret::Store::FSDirectory.new(''path/to/index''))
results = []
num_results = index.search_each(''search word(s)'', { :first_doc => 0,
:num_docs => 50 }) do | doc, score |
results << index[doc]
end
Any help would be awesome. Thanks!
- chris
--
Posted via http://www.ruby-forum.com/.
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 Sep 05
4
Ferret 0.10.2 - Index#search_each() and :num_docs
Hi,
I seem to be having trouble getting more than 10 hits from
Index#search_each since upgrading to 0.10.2 (ie, this was working in
0.9.4). Maybe a bug, as the #search_each doesn''t seem to use the options
parameter any more ?
Thanks,
Neville
===========================================
require ''rubygems''
require ''ferret''
p Ferret::VERSION
idx =
2006 Jan 10
1
search_each returns partial results?
Hi,
I''m having some trouble with ferret search_each. I''m posting rails''
script/console output, so I guess you can decrypt it:
>> res = []
=> []
>> index.search_each(''name: a*'') do |doc, score|
?> res << doc
>> end
=> 50
>> res.size
=> 10
>>
I''m guessing the ''=>50''
2006 Apr 21
3
Sorting Search results
I tried sorting the search results in Ferret::Index::Index#search and
what I found was that the sort is applied not to the whole search but to
the returned results.
Suppose I have these results:
Text - Num
foo - 2
bar - 3
far - 4
boo - 1
If I limit the search to the first two and sort by num I get:
foo - 2
bar - 3
while I think the natural behaviour would be:
boo - 1
foo - 2
Is this
2006 May 17
8
How to implement full-text search with OR just like google?
The current full-text search will return the AND collection results,for
example,if we use Article.search("aa bb"),then the articles that include
"aa" and "bb" in the fields will be returned,how to return the articles
that include "aa" OR "bb" effectly? A stumb method is to setup two
queries respectly and collect them together with remove the
2006 Jan 02
11
aligning Ferret''s IndexSearcher.search API with Lucene''s
...e the methods
that return TopDocs to a module, which is more or less the same as a
Java interface, and implement the methods that return Hits directly in
the class? What is a good way to do this that feels Rubyish and takes
advantage of its strengths and idioms?
* The options to limit the search (first_doc and num_doc) in
Search::IndexSearcher and the code that implements them should
probably be moved out of Search::IndexSearcher into Index::Index
* Are there lower level issues I am not aware of that would make any
of this a bad idea?
Am I missing something here? Are there reasons not to have Ferre...
2005 Dec 02
43
ANN: acts_as_ferret
Hi all
This week I have worked with Rails and Ferret to test Ferrets (and Lucenes)
capabilities. I decided to make a mixin for ActiveRecord as it seemed the
simplest possible solution and I ended up making this into a plugin.
For more info on Ferret see:
http://ferret.davebalmain.com/trac/
The plugin is functional but could easily be refined. Anyway I want to share it
with you. Regard it as a
2005 Dec 02
43
ANN: acts_as_ferret
Hi all
This week I have worked with Rails and Ferret to test Ferrets (and Lucenes)
capabilities. I decided to make a mixin for ActiveRecord as it seemed the
simplest possible solution and I ended up making this into a plugin.
For more info on Ferret see:
http://ferret.davebalmain.com/trac/
The plugin is functional but could easily be refined. Anyway I want to share it
with you. Regard it as a
2007 Feb 25
9
Ferret 0.11.0-rc1
Hey folks,
Sorry for cross posting like this but this is an important
announcement for all Ferret users.
** Description **
Firstly for those who don''t know, Ferret is a full-text search library
which makes adding search to your application a breeze. It''s much
faster than MySQL full-text search as well most other search libraries
out there. It allows you to do Boolean (+ruby +