search for: total_hit

Displaying 20 results from an estimated 79 matches for "total_hit".

Did you mean: total_hits
2007 May 30
4
aaf and dynamic attrs: a bug?
...aboo.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 Contact.find(:first).respond_to?(:first_name_to_ferret) assert_equal 1, Contact.find_by_contents(''Y*'').total_hits assert_equal 1, Contact.find_by_contents(''first_name:Y*'').total_hits Contact.aaf_index.close FileUtils.rm_rf ''index'' Contact.acts_as_ferret :fields => [ :first_name, :last_name ] assert Contact.find(:first).respond_to?(:last_name_to_ferret)...
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 Jan 15
3
Wrong total_hits when using conditions in find_by_contents
...th the following fields: title, visible - and these records [code]title, visible ferret talk, 1 ruby talk, 0 ruby on rails, 1 lets talk about ruby, 1[/code] If I let Article act as a ferret, and do: result = Article.find_by_content(''ruby'') Result will contain 3 items and "total_hits" will return 3 However, if I add a condition: result = Article.find_by_content(''ruby'', {}, ''visible = 1'') Result will contain 2 items - which is correct But "hotal_hits" will still return 3 - not what I would expect. -------------------------...
2006 Sep 22
1
QueryParser bug?
...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 Ruby", :content => "yada yada yada"} puts index.search("ruby").total_hits # returns 1 query_parser = Ferret::QueryParser.new( :default_field => :title ) query = query_parser.parse("title:ruby") puts index.search(query).total_hits # returns 1 query_parser = Ferret::QueryParser.new( ) # :default_field: Default: "*" # The default field to search wh...
2007 Feb 10
7
Adding entry breaks index
...ork on the debian server) narrowed it down to one single entry that when you add or delete from the index completely changes results in unrelated searches. a little console output shows this best. index = Ferret::Index::Index.new(FerretConfig::INDEXOPTIONS) puts index.search("westpac").total_hits 286 puts index.search("westpac branch").total_hits 277 doc = Entry.find(1094481).make_entry_ferret_doc => {:latitude1d=>"36.9", :address=>"61 Remuera Rd, Newmarket", :longitude1d=>"174.8", :name=>"Spiro''s Florists", :precis...
2007 Apr 30
1
Can''t search fields with space
...get it to return any result whether I use :city => {:store => :no, :index => :untokenized}, or :city => {:store => :no} in my User model''s acts_as_ferret option >>> User.find_by_contents("city:(cal poly)") => #<ActsAsFerret::SearchResults:0x4e62608 @total_hits=0, @results=[]> >> User.find_by_contents("city:(''cal poly'')") => #<ActsAsFerret::SearchResults:0x4e5aae8 @total_hits=0, @results=[]> >> User.find_by_contents("city:(''cal\ poly'')") => #<ActsAsFerret::SearchResults...
2007 Jan 13
5
Problems using 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 "p.total_hits" and get 7.. but the results are empty. If i iterate over the p in this i get no entries. How do I get to the entries that it found for the search? Am I doing something wrong? Thanks, William
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], options, {:conditions => "account_id=#{u.account_id}"}) re.size 5 re.total_hits 620 Looks broken to me. Br, Morten
2006 Oct 10
5
oddness when adding to index -
...ot;, "Top daw g dog walker"].each {|text| i << text } => ["While you were out pet care", "Eastside dog walker", "Top dawg dog walker"] *** Now let''s do some searches *** irb(main):006:0> puts i.search(''pet'') TopDocs: total_hits = 1, max_score = 0.878416 [ 0 "While you were out pet care": 0.878416 ] => nil irb(main):007:0> puts i.search(''dog'') TopDocs: total_hits = 2, max_score = 0.500000 [ 1 "Eastside dog walker": 0.500000 2 "Top dawg dog walker": 0.500000 ] =>...
2007 Sep 05
1
AAF and DRb with highlighting
....aaf_index.ferret_index results = [] default_options = {:limit => 10, :page => 1} options = default_options.merge options options[:offset] = options[:limit] * (options[:page].to_i - 1) # search_each is the core search function from Ferret, which Acts_as_ferret hides total_hits = index.search_each(query, options) do |hit, score| doc = index[hit] result = {} article = Article.find(doc[:id]) # Store each field in a hash which we can reference in our views result[:headline_highlight] = index.highlight(query, hit, :field => :headlin...
2007 May 03
1
Numeric Range or comparision doesn''t work
...num => 1000, :data => "yes"}, {:num => 1000, :data => "no"} ] ?> puts index.process_query(''data:yes AND num:[10 100]'') +data:yes +num:[10 100] => nil >> puts index.search(''d:data:yes AND num:[10 100]'') TopDocs: total_hits = 2, max_score = 1.777895 [ 2 "": 1.777895 4 "": 1.777895 ] => nil >> puts index.process_query(''data:yes AND num:[2 100]'') num:"data yes <> num 2 100"~4 => nil >> puts index.process_query(''num:...
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
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 acts_as_ferret :fields => [:content] end b1 = Book.create(:title => "Book One") b1.page.add(:content => "The cat s...
2007 May 05
4
Stop words, fields, StandardAnalyzer quagmire
...r is that as you can see, I have a field "status_id". This field lets me filter for profiles that are published or draft in my CMS. Before I added the StandardAnalyzer, the status_id field worked fine in queries like this: a = Profile.find_by_contents("smith status_id:100") a.total_hits => 2 # this is correct, only 2 are published a = Profile.find_by_contents("smith") a.total_hits => 4 # this is correct, there are 4 total So, you can see that the status_id was automatically "AND"-ed to the query word. However, after adding the above StandardAnalyzer c...
2007 Jul 18
5
Strange search result with conditions in find_by_contents
...erge options # get the offset based on what page we''re on options[:offset] = options[:limit] * (options.delete(:page).to_i-1) # now do the query with our options results = Topic.find_by_contents(q, options, find_options) puts options puts find_options return [results.total_hits, results] end -------------------------------- i display 10 results in one page. In SearchController, if i run this code: @total, @topics = Topic.full_text_search(params[:searchTerms], :page => (params[:page]||1)) and input a search term, it will get 16 result messages. when i click to the next...
2007 May 29
1
is "IN" a special word?
...sult. class User < ActiveRecord::Base acts_as_ferret :fields => { :user => {:store => :no }, :len => {:store => :yes} } end ruby script/console >> User.find_by_contents(''Cal'') => #<ActsAsFerret::SearchResults:0xb762ab58 @total_hits=1, @results=[#<User:0xb762b8f0 @ferret_score=0.244397431612015, @ferret_rank=1, @attributes={"user"=>"Cal Poly", "id"=>"1", "len"=>nil}>]> >> u = User.new => #<User:0xb76293fc @new_record=true, @attributes={"user&...
2007 May 02
4
Wrong total_hits when using conditions in find_by_contents
...gt; 1} options = default_options.merge options # get the offset based on what page we''re on options[:offset] = options[:limit] * (options.delete(:page).to_i-1) # now do the query with our options results = Topic.find_by_contents(q, options, find_options) return [results.total_hits, results] end in my SearchController: if params[:doSearch] == "true" if params[:query] == "" flash[:notice] = ''Please enter some words to search on.'' else @conditions = " 1 = 1"; if params[:dateRange] != "" @conditions += " and creat...
2006 Nov 25
5
Metaphone analysis
Not sure how much this will interest people but I don''t have a blog so I''m posting something I threw together today cause I think it might be useful. In what little free time I have I''ve been wanting to put together a Rails/Ferret based restful dictionary. So I finally got a chance to get started today so the first thing I wanted to do was implement a metaphone
2006 Sep 23
8
svn problems
I can consistently segfault the 0.10.4 gem, so I''m trying to get the subversion version working with hopes towards tracking the problem down. I have a fresh SVN checkout but: a) the version (in ferret.rb) claims to be 0.9.6; and b) Ferret::Index::FieldInfos and a couple other classes are missing at run time. It looks like this is because they''re not exported in the C
2006 Aug 29
6
adding new items to index breaks searches with *
Hi after upgrading to ferret 0.10.1 and bleeding edge aaf i''m getting some strange behavior. Generally much better stability with new version of ferret but when i add new items for some reason i can no longer search with a *. Or rather i can but it returns no results and no errors. I can search and get results normally on other searches and when i rebuild the index i can search with