Hi Champs, I am using this fuzzy query in ferret engine to search something. "Summary.find_with_ferret(@fuzzy_query, {:limit => :all})" where Summary is a model class which contains each and every details of any item. Now, when i run this code in GUI, I mean when i search something in browser it works fine. But when i test this by command line by passing the same parameters as i do using GUI, its not working. I am doing it like this in integration testing :- post "/home/seach", :search_value => "abc". This fuzzy query gives me nothing. I am snatching my head over it.. Hope i''ll get my answer here.. :) -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
2010/1/20 Hemant Bhargava <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org>:> Hi Champs, > > I am using this fuzzy query in ferret engine to search something. > "Summary.find_with_ferret(@fuzzy_query, {:limit => :all})" where Summary > is a model class which contains each and every details of any item. > > Now, when i run this code in GUI, I mean when i search something in > browser it works fine. But when i test this by command line by passing > the same parameters as i do using GUI, its not working. I am doing it > like this in integration testing :- post "/home/seach", :search_value => > "abc". This fuzzy query gives me nothing. I am snatching my head over > it..I don''t know about ferret but I would have thought that would be a get rather than a post. Have a look in development.log and see what is the request sent when you click on the link that works in your browser. Colin. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
No it is post only.. I tried my luck giving it "get" as well but not working.. Also the query generates the same thing. select * from summaries .. before it, it is setting the default ferret variables. Anyway thanks for your quickie :) Colin Law wrote:> 2010/1/20 Hemant Bhargava <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org>: >> "abc". This fuzzy query gives me nothing. I am snatching my head over-- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
2010/1/20 Hemant Bhargava <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org>:> No it is post only.. I tried my luck giving it "get" as well but not > working.. Also the query generates the same thing. select * from > summaries .. before it, it is setting the default ferret variables.So what is the difference between the logs between running it from the browser and running it from the test? When you say the search is not working in the test what do you mean? I presume you have got some data in the test database via fixtures or whatever so the search will find something. Colin -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Yeah Colin.. You are right. there should not be any difference in searching from browser or from test.. But still the problem exists. Also i executed rake db:test:load to take all the development data into test database.. Is there any parameter we have to use during test or something else .. ? Colin Law wrote:> 2010/1/20 Hemant Bhargava <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org>: >> No it is post only.. I tried my luck giving it "get" as well but not >> working.. Also the query generates the same thing. select * from >> summaries .. before it, it is setting the default ferret variables. > > So what is the difference between the logs between running it from the > browser and running it from the test? > When you say the search is not working in the test what do you mean? > I presume you have got some data in the test database via fixtures or > whatever so the search will find something. > > Colin-- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Hi, Is there any problem in these defaults while searching with ferret? {:reindex_batch_size=>1000, :registered_models=>[Summary(id: integer, class_id: integer, class_summary: text, class_primary_field: string, created_at: datetime, updated_at: datetime)], :ferret_fields=>{:class_primary_field=>{:highlight=>:yes, :via=>:class_primary_field, :boost=>5, :store=>:no, :index=>:yes, :term_vector=>:with_positions_offsets}, :class_summary=>{:highlight=>:yes, :via=>:class_summary, :boost=>0, :store=>:no, :index=>:yes, :term_vector=>:with_positions_offsets}}, :user_default_field=>nil, :enabled=>true, :fields=>{:class_primary_field=>{:boost=>5}, :class_summary=>{:boost=>0}}, :mysql_fast_batches=>true, :index_dir=>"/scratch/ABC/Sandboxes/abc/index/development/summary", :raise_drb_errors=>false, :index_base_dir=>"/scratch/ABC/Sandboxes/abc/index/development/summary", :name=>:summary, :single_index=>false, :ferret=>{:create_if_missing=>true, :default_field=>[:class_primary_field, :class_summary], :key=>:key, :analyzer=>#<Ferret::Analysis::StandardAnalyzer:0xb76d28a8>, :auto_flush=>true, :or_default=>false, :path=>"/scratch/ABC/Sandboxes/abc/index/development/summary", :handle_parse_errors=>true}} Hemant Bhargava wrote:> Yeah Colin.. You are right. there should not be any difference in > searching from browser or from test.. But still the problem exists. Also > i executed rake db:test:load to take all the development data into test > database..-- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
2010/1/21 Hemant Bhargava <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org>:> Yeah Colin.. You are right. there should not be any difference in > searching from browser or from test.. But still the problem exists. Also > i executed rake db:test:load to take all the development data into test > database..I don''t think rake db:test:load loads the development data into the test db. For testing you should either be using fixtures or another method of loading the db with test data. It is better to insert replies into posts rather than top posting as then it is easier to see which question is being answered. See below> > Is there any parameter we have to use during test or something else .. ? > > Colin Law wrote: >> 2010/1/20 Hemant Bhargava <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org>: >>> No it is post only.. I tried my luck giving it "get" as well but not >>> working.. Also the query generates the same thing. select * from >>> summaries .. before it, it is setting the default ferret variables. >> >> So what is the difference between the logs between running it from the >> browser and running it from the test?You have not answered the question above>> When you say the search is not working in the test what do you mean?You have not answered the question above>> I presume you have got some data in the test database via fixtures or >> whatever so the search will find something. >> >> Colin > > -- > Posted via http://www.ruby-forum.com/. > > -- > You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en. > > > >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Ok fine. Sorry for that .. The scenario is i have some data into my fixtures and i am using rake db:fixtures:load to load that data into development database and to load the development database data into test i am using rake db:test:load..i think its right.. is''nt it? or should i use rake db:test:clone.. Colin Law wrote:> > I don''t think rake db:test:load loads the development data into the > test db. For testing you should either be using fixtures or another > method of loading the db with test data. > > It is better to insert replies into posts rather than top posting as > then it is easier to see which question is being answered. See below > >>> browser and running it from the test? > You have not answered the question aboveI do not know this. This is what i am conflicting my head upon. I am executing the same method and passing the same paramters to method. Checked it many times. The only thing i found is that when i search with browser- search query which is "Summary.find_with_ferret(fuzzy_query, {:limit => :all})" gives me the results but when i run it in a test, it gives me nothing. That what we have to find out that why this query return nothing. I hope you got it right now. :)> >>> When you say the search is not working in the test what do you mean? > > You have not answered the question above-- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
2010/1/21 Hemant Bhargava <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org>:> Ok fine. Sorry for that .. > > The scenario is i have some data into my fixtures and i am using rake > db:fixtures:load to load that data into development database and to load > the development database data into test i am using rake db:test:load..i > think its right.. is''nt it? or should i use rake db:test:clone..I don''t know whether that is right, I have never tried it that way. Have you looked at the test db to check that the data are there? Usually the fixtures are loaded into the test db at test time. I presume you have worked through the Testing guide at http://guides.rubyonrails.org/. Colin> > > Colin Law wrote: >> >> I don''t think rake db:test:load loads the development data into the >> test db. For testing you should either be using fixtures or another >> method of loading the db with test data. >> >> It is better to insert replies into posts rather than top posting as >> then it is easier to see which question is being answered. See below >> >>>> browser and running it from the test? >> You have not answered the question above > I do not know this. This is what i am conflicting my head upon. I am > executing the same method and passing the same paramters to method. > Checked it many times. The only thing i found is that when i search with > browser- search query which is "Summary.find_with_ferret(fuzzy_query, > {:limit => :all})" gives me the results but when i run it in a test, it > gives me nothing. That what we have to find out that why this query > return nothing.As mentioned above I think the first thing is to confirm that the data are in the test db ok. Are there other tests that rely on the data that should be there. Are they passing? Colin> > I hope you got it right now. :) > >> >>>> When you say the search is not working in the test what do you mean? >> >> You have not answered the question above > > -- > Posted via http://www.ruby-forum.com/. > > -- > You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. > For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en. > > > >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Colin Law wrote:> I don''t know whether that is right, I have never tried it that way. > Have you looked at the test db to check that the data are there? > > Usually the fixtures are loaded into the test db at test time. I > presume you have worked through the Testing guide at > http://guides.rubyonrails.org/. >Yeah that is fine. I have checked. I agree that fixtures will be loaded at test time. Also i have read a lot of tutorials including this.> Colin > >>> >>>>> browser and running it from the test? >>> You have not answered the question above >> I do not know this. This is what i am conflicting my head upon. I am >> executing the same method and passing the same paramters to method. >> Checked it many times. The only thing i found is that when i search with >> browser- search query which is "Summary.find_with_ferret(fuzzy_query, >> {:limit => :all})" gives me the results but when i run it in a test, it >> gives me nothing. That what we have to find out that why this query >> return nothing. > > As mentioned above I think the first thing is to confirm that the data > are in the test db ok. Are there other tests that rely on the data > that should be there. Are they passing? > > ColinTest db contains exactly the same data as of development database. I have written many testcases and thay are passing but only this ferret engine specific is failing. I dunt know whay that line is giving nothing while the same line is fetching results if i do it using browser.. :''( -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
2010/1/21 Hemant Bhargava <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org>:> Colin Law wrote: > >> I don''t know whether that is right, I have never tried it that way. >> Have you looked at the test db to check that the data are there? >> >> Usually the fixtures are loaded into the test db at test time. I >> presume you have worked through the Testing guide at >> http://guides.rubyonrails.org/. >> > > Yeah that is fine. I have checked. I agree that fixtures will be loaded > at test time. Also i have read a lot of tutorials including this.In that case I have run out of ideas, except that I don''t think you confirmed that the development.log entry for the browser request is the same as the test.log entry for the failing test. Post them here if you like. Colin -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.