search for: find_by_content

Displaying 20 results from an estimated 181 matches for "find_by_content".

Did you mean: find_by_contents
2007 May 30
4
aaf and dynamic attrs: a bug?
...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 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)....
2007 May 18
1
find_by_contents + ''conditions'' returning incorrect results
...xt search on financial institutions and to constrain that list by state (=) or states (IN). My lenders model includes a name and a state, among other fields. In my lenders model: acts_as_ferret :fields => [:name] Running this in script/console, I get a correct result (about 2100 hits): Lender.find_by_contents("bank") But when I start constraining with active record I get weird results. This turns up one hit, which is correct: Lender.find_by_contents("suntrust", {}, {:conditions=>["sta1 = ''DC''"]}) But this turns up zero hits, when it should be 11 hit...
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...
2006 Aug 25
4
using conditions
Hello guys, I''m pretty new to using AAF and am having a slight problem with 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 -- Posted via http://www.ruby-forum.com/.
2007 Apr 30
1
Can''t search fields with space
...ser model that has a city field which is searchable using acts_as_ferret. But I can''t 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_content...
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 seems that there is no way to access the result set... I read somewhere that it''s not implement yet.. So any knows...
2006 Nov 02
2
highlighting with find_by_contents
I''m trying to highlight keyword snippets using the highlight method of the results returned from find_by_contents (the actual models), but always come up with an empty array. Any ideas what could be going wrong? -- Posted via http://www.ruby-forum.com/.
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 :...
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 development with Ruby On Rails, PHP and ASP www.kozmo.co.uk 07...
2006 Sep 19
2
acts_as_ferret and Fuzzy Searching
...application. I''ve tried setting the following in my environment.rb file. Ferret::Search::FuzzyQuery.default_min_similarity = 0.75 Ferret::Search::FuzzyQuery.default_prefix_length = 2 When I go into the console, I can see those values as the default but when I run a search like Post.find_by_contents(''word~'') I always get the same results, no matter how I set the above variables. I can say Post.find_by_contents(''word~0.75'') and Post.find_by_contents(''word~0.5'') and get different results. Any help is appreciated. Thanks, Steve
2009 Oct 26
2
find_with_ferret issue
Hi All, I''m implementing the ferret search engine on my railspace project. In my User and Info model, I have line that reads: acts_as_ferret :fields => [''username'', ''email''] This initially generates a find_by_contents which is added to the community contoller: @users = User. find_by_contents(query, :limit => :all) THis returned a method error, and after some digging, it turns out that the find_by_contents is not replaced with: @users = User.find_with_ferret(query, :limit => :all) HOWEVER..... With thi...
2006 Nov 28
1
find_by_contents never finds anything on my model
...#39;'m using the aaf plugin on a model named Book. This model isnt a typical rails model in the fact that it doesnt have an "id" column as its primary key but instead has a string column named ISBN that is used as the primary key. When I try to search for anything in the model using find_by_contents it never finds anything. Trying to troubleshoot, I added an id column in my model as an integer and made it auto increment. Once I added this, added my sample data back in, and rebuilt my index, I noticed that I could search all of a sudden using find_by_contents. I changed it back again, and t...
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 May 31
5
Help with sorting arrays with objects in it
I have to build an array through both activerecord and also through a ferret index. I was hoping to find a way of sorting the array as i combine the two so def advanced_search(search_text, store, format, sortby) # find items in ferret index items = Item.find_by_contents(search_text) # and now find all the items from a certain store or category items_from_sql = Item.find_by_sql("SELECT * .....") @list = [] items.each do |i| @list << i if items_from_sql.include?(i) end #now i need to sort @list somehow with sortby which would equal "ti...
2007 May 30
2
How to search with limit by field
Hello, I have a ferret index with 2 fields: Acts_as_ferret :fields => [:client, :content] If I do model.find_by_contents(query) I obtain all results by the query but I would like to obtain 3 results for each client. Any ideas? Thanks for all. -- Posted via http://www.ruby-forum.com/.
2007 Jan 15
3
Wrong total_hits when using conditions in find_by_contents
...;'s the problem + a bugfix. Lets say you have a model "Article" with 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&quot...
2007 Jun 15
2
indexed ''text'' (not string) column not used when searching, unless explicitely specified!!
...e included a mysql ''text'' column in my index, and aaf/Ferret doesn''t use it when I search, UNLESS I specify it as a restrictor, and then it only searches in that field! For example: => 0 results are returned by a standard (__all__ fields ?) search >> Entity.find_by_contents "zixi" Query: zixi total hits: 0, results delivered: 0 BUT if I search __only__ in 1 field, I find something >> Entity.find_by_contents "extra:zixi" Entity Load (0.001286) SELECT * FROM entities WHERE (entities.id in (''1723'')) AND ( (e...
2007 Mar 23
4
how to select only some fields?
hi, how can i select only some fields when ferret do the query? like a :select => ''id'', for the find....i''ve tried to do it where i do the :include => [:something], but it doesn''t work...is it right or i''ve to put it in another place? -- Posted via http://www.ruby-forum.com/.
2007 Oct 15
0
Inconsistent results between multi_search and find_by_contents (is "other" a reserved word?)
I have a Computer type and I''m trying to query agianst it. When I do the query with find_by_contents, I get correct results. However, when I query using multi_search, I get incorrect results. I''m using the most recent version of Acts As Ferret and Ferret This returns the correct results: Computer.find_by_contents( "device_type:laptop AND os_type:other" ) This returns too ma...
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 31...