Displaying 20 results from an estimated 500 matches similar to: "Wrong total_hits when using conditions in find_by_contents"
2007 May 02
4
Wrong total_hits when using conditions in find_by_contents
In my model Topic:
acts_as_ferret({ :fields => {:username => {:store => :yes, :boost =>
30}, :subject => {:store => :yes, :boost => 20}, :body => {:store =>
:yes, :boost => 10}}, :remote => true }, { :analyzer =>
Ferret::Analysis::RegExpAnalyzer.new(/./, false) })
def self.full_text_search(q, options = {}, find_options = {})
return nil if q.nil? or
2007 Jul 18
5
Strange search result with conditions in find_by_contents
Hi, guys:
Strange search result with conditions in find_by_contents!
first of all, i''ve installed the acts_as_ferret to my project vender
folder by ''ruby script/plugin install
svn://projects.jkraemer.net/acts_as_ferret/tags/stable/acts_as_ferret''
in my SearchController
def searchforum
if !params[:doSearch].nil?
if params[:searchTerms].nil? || params[:searchTerms] ==
2006 Oct 21
2
find_by_content result set
Hi Guys
I''m experiencing with AAF and Ferret with the intention of deploying
into the site that I am working on now.
So I setup AAF to index 3 fields that I have in this model and i tried
doing a find_by_contents and it returned the
#<FerretMixin::Acts::ARFerret::SearchResults:0xb74b5bec
@total_hits=1157, @results=[#<Payprofile:0xb74cc39c
@attributes={"add......
but it
2006 Aug 17
1
find_by_contents fails with :include option
find_by_contents will fail if you specify :include in the find_options
parameter. The problem is on line 313:
313: conditions = [ "id in (?)", id_array ]
314: # combine our conditions with those given by user, if any
315: if find_options[:conditions]
316: cust_opts = find_options[:conditions].dup
317: conditions.first << " and " << cust_opts.shift
318:
2007 Aug 23
3
AAF: find_by_contents on AR Association Total Hits
I seem to be getting some behaviour thats unexpected (for me anyway)
when using find_by_contents on an ActiveRecord has_many association. The
results that are returned are only the records that belong to the model
returned, but the total_hits that are being returned appear to be for
the whole table.
e.g.
class Book < AR::Base
has_many :pages
end
class Page < AR::Base
belongs_to :book
2007 May 16
7
return ONLY total_hits without querying from real database
Hey guys,
I know I can run search(q).total_hits, but if I try to put :limit=>0 it
gives me an error. I don''t want it actually query any of the results, I
just want it to tell me how many total_hits I would have if I wanted to
search it.
How can I do this?
--
Posted via http://www.ruby-forum.com/.
2007 Dec 02
1
total_hits and conditions
Hi. I''m running 0.11.4. The problem I''m having, appears to have been solved
before according to various posts I googled up, but possibly the fix got removed
from 0.11.3 to 0.11.4?
re = Entry.multi_search(''service'', [Ticket], options, {})
re.size
620
re.total_hits
620
Now add conditions:
re = Entry.multi_search(''service'', [Ticket],
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 Feb 28
5
How to use find_options in multi_search
Hello everyone,
I''m using multi-search to search in some attributes of two classes. One
of the attributes is the id of the customer. For each multi_search I
want to do a give the id of the current customer as a parameter. This
should only return results for the given customer.
My current code looks like this:
Folder.multi_search(@search_query, [Myfile])
I noticed in the API you can
2007 Jun 20
1
Count_by_content ??
Is there a count_by_content alternative to the find_by_content action?
This is because I''m wanting to do the following in my pagination method:
def list
# step 1: set the variables you''ll need
page = (params[:page] ||= 1).to_i
items_per_page = 20
offset = (page - 1) * items_per_page
# step 2: instead of performing a find, just get a count
item_count =
2006 Nov 27
2
find_conditions in acts_as_ferret find_by_contents
Hi all,
Every time I try to add options for the find_conditions argument of
find_by_contents I get the following:
a = AnnotatedLink.find_by_contents(''test'', {}, {:conditions =>
''category_id IS NOT NULL''})
>> NoMethodError: You have a nil object when you didn''t expect it!
You might have expected an instance of Array.
The error occured while
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) *
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 Aug 25
7
acts_as_ferret with conditions
Hello guys,
Having a slight problem with acts_as_ferret, specifically using a
condition. I have the following code
@results = SupplierProduct.find_by_contents(params
[:search], :conditions => [''area_id = ?'', @area])
and it seems the condition isn''t being applied. Does anyone have any
pointers?
Cheers,
Alastair
------
Alastair Moore
Standards compliant web
2007 May 30
4
aaf and dynamic attrs: a bug?
Hi!
I faced some issue while using it for dynamic attrs indexing/search.
Maybe I made something wrong. Here is test method. Everything works just
fine until last line http://pastie.caboo.se/66274 . Tested on both
stable and trunk of aaf and ferret 0.11.4.
the short version of code below:
Contact.acts_as_ferret :fields => [ :first_name ]
assert
2008 Jan 03
0
Problem (with fix?) for passing :multi => [ ]
Max, seems to me that your code would help to make things more robust,
if it''s a public API then it should stand up to a little abuse in ways
not intended. maybe more of an enhancement than a bug fix, but a fix
just the same.
Max Williams wrote:
> I''m using acts_as_ferret, passing through multiple classes using :multi
> and also some conditions. The way i''m
2009 Jan 23
3
Bug regarding ActiveRecord and TimeWithZone
I''ve discovered a strange behavior regarding ActiveRecord and
TimeWithZone
I''ve seen the error when using SQL Server, I have not yet tried with any
other database.
Here''s output from the console - "User" is a simple model made with a
migration.
-----------------------------------------
>> d1 = User.find(:first).created_at
=> Thu, 21 Jun 2001
2006 Oct 09
2
hello, acts_as_ferret questions, any help greatly appreciate
hi, ive been reading up on ferret, acts_as_ferret, and other search
plugins for rails.
after reading about ferret, i found out about the acts_as_ferrt plugin.
my first question about acts_as_ferret:
1. from reading about ferret, do i still need to manually save the IDX
and add a IDX column field to my model table for acts_as_ferret to work?
they say that acts_as_ferret handles everything,
2006 Sep 22
1
QueryParser bug?
I cooked up a little script to show what I mean. This doesn''t look right
to me, but maybe I just completely misunderstand QueryParser.
Same output on mswin32, unix, ferret 0.9 and 0.10
Cheers, Sam
require ''rubygems''
require ''ferret''
p Ferret::VERSION # 0.10.6
index = Ferret::Index::Index.new()
index << {:title => "Programming
2007 Jan 13
5
Problems using acts_as_ferret
Hi all,
I''m trying to use acts_as_ferret and have run into a brick wall.
My model is Page
My controller is Pages_controller.
When in console, I can search for contents, and find results. For
example, when I search for "spam" it "finds" 7 results.
=> #<FerretMixin::Acts::ARFerret::SearchResults:0x2693934
@total_hits=7, @results=[]>
you can do a