search for: search_each

Displaying 20 results from an estimated 116 matches for "search_each".

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:...
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 guess...
2006 Sep 05
4
No matches
...;< {:name => "Joe"} index << {:name => "Sandy"} index << {:name => "Billy"} index << {:name => "Lona"} index << {:name => "Frank"} index.optimize query = Search::TermQuery.new(:name, "Joe") index.search_each(query, {:limit => :all}) do |doc, score| puts ''i am here to just drink some hot chocolate.'' puts index[doc]["name"] end -------------END SCRIPT---------------- -- 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 Aug 24
4
[0.10.0] Index#search_each options ignored
Hi Dave, The options hash is not used in search_each() method. -- Posted via http://www.ruby-forum.com/.
2006 Sep 26
3
concurrency / #search_each problem / segfault
Hello everyone, I was stress-testing my application (running on Rails via FastCGI) by letting two concurrent users (not human .. an app called ''siege'') a) save an Article and b) search for all Articles. I am searching via Article.ferret_index.search_each( ..) do |doc_id,score| doc = index[doc_id] .. end and writing via Article.ferret_index << self.to_doc where Article.ferret_index is implemented as in ''act_as_ferret'': @@ferret_index = nil def Article::ferret_index @@ferret_index ||= Ferret::Index::I...
2007 Mar 21
4
Cannot delete for id of type Array
Hello list, I have a little weird error when deleting documents from the index. I''m using the following code. ferret_index = Ferret::Index::Index.new(:path => FERRET_INDEX_PATH) query = Ferret::Search::TermQuery.new(:fk_file_id, "#{_fk_file_id}") ferret_index.search_each(query) do | id | ferret_index.delete(id) end And I get the following error Cannot delete for id of type Array As I see it the only way this could happened is if search_each returns an Array of ID''s but it couldn''t right? I''m using version 0.11.3. Regards, Henrik
2006 Sep 09
2
search_each segmentation fault and parser anomoly
The included test script turned up the following anomolies (run against Ferret 0.10.3, but had same problems with 0.10.2): 1. When the content word is not in the index the inclusion of a wildcard file term causes search_each to throw a segmentation fault. $ ./test.rb zzz file:*.txt query: +content:zzz +file:*.txt ./test.rb:28: [BUG] Segmentation fault ruby 1.8.4 (2005-12-24) [i486-linux] Aborted 2. When the file query term is file:* wildcard the parser translates it to +* instead of +file:* $ ./te...
2006 Sep 15
1
Custom analyzer not invoked?
...;'== Adding document to index...'' index = Index::Index.new(:analyzer => MyAnalyzer.new()) index << { :content => "The quick brown fox" } index << { :content => "The cow jumps over the moon" } puts ''== Searching Brown...'' index.search_each(''content:Brown'') do |doc, score| puts "Document #{doc} found with a score of #{score}" end puts ''== Searching Foo...'' index.search_each(''content:Foo'') do |doc, score| puts "Document #{doc} found with a score of #{score}"...
2006 Jul 18
10
searching with chinese chars
...equire ''ferret'' include Ferret index = Index::Index.new(:path => ''/var/index'', :default_field => "*") cgi = CGI.new("html4") result = "" if cgi[''query''] and not cgi[''query''].empty? index.search_each(cgi[''query'']) do |doc, score| result << "<table border=''1''> <tr><td>#{index[doc][''tileid'']}</td><td>#{index[doc][''title'']}</td><td>#{index[doc][''description...
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 Mar 07
0
A note about #search vs #search_each
...st "solved" an issue which I mentioned on this list many moons ago, regarding searches somehow being serialized, such that a long search would cause others to wait noticeably. Anyhow, after coding both :limit and applying homegrown thread time limit monitoring, I discovered that Searcher#search_each uses rb_thread_critical = Qtrue whereas Searcher#search doesn''t. I changed my code to use TopDocs and Searcher#search and viola, concurrent searches! Cheers, Nevill
2006 Sep 22
2
Searching untokenized fields
...:no) i << {:type => "Movie", :name => "Indiana" } i << {:type => "Movie", :name => "Forrest" } i << {:type => "People", :name => "Forrest" } now searching for forrest should give 2 results.. >> i.search_each("forrest") do end => 2 now i would like to exclude the movie, so i tried to do this: >> i.search_each("forrest AND NOT type:movie") do end => 2 >> i.search_each("forrest AND NOT type:Movie") do end => 2 So how to exclude objects with a certain u...
2006 Mar 01
2
Sorting the Result
...ons) sort: An array of SortFields describing how to sort the results. I have created index with two fields: ''file'' and ''content'' When I give SortField name as ''file'' while searching, it results into error. The exact command given by me: index.search_each("sleepless AND dreams", :num_docs => 100, :sort => ''file'') do |doc, score| .... end My question is how do I give field name for sorting. Thanks and Regards, P L Patodia -- Posted via http://www.ruby-forum.com/.
2005 Dec 14
2
undefined method `add'' for Ferret::Search::BooleanQuery
Up to now in my ferret development I have been using simple single-word strings as my search queries. I just now am trying to increase the complexity of my queries. When I was passing a single word with no spaces in my index searches, like so: count = index.search_each(''testing'') do |d, s| ... end everything worked fine. But now when I do something like this: count = index.search_each(''contents:"testing|trucks"'') do |d, s| ... end I get the following error: undefined method `add'' for #<Ferret::...
2007 Apr 09
5
highlight crashes
...from /usr/local/lib/ruby/1.8/monitor.rb:238:in `synchronize'' from /usr/local/lib/ruby/gems/1.8/gems/ferret-0.11.4/lib/ferret/index.rb:195:in `highlight'' from test.rb:25 from /usr/local/lib/ruby/gems/1.8/gems/ferret-0.11.4/lib/ferret/index.rb:385:in `search_each'' from /usr/local/lib/ruby/gems/1.8/gems/ferret-0.11.4/lib/ferret/index.rb:384:in `search_each'' from /usr/local/lib/ruby/1.8/monitor.rb:238:in `synchronize'' from /usr/local/lib/ruby/gems/1.8/gems/ferret-0.11.4/lib/ferret/index.rb:380:in `search_each...
2006 Jan 19
2
Simple Ferret Questions
I am trying to use Ferret for searching for users based on first and last name. In my index, I am adding the first_name, last_name, and a full_name which is basically "#{first_name} #{last_name}". I am searching the index using something like the following query: INDEX.search_each(%Q/first_name:#{query}* OR last_name:#{query}* OR full_name:#{query}*/) do |doc, score| The problem I am having is when I search the index it is tokenizing my query so that each word is being evaluated independantly. For example, if I search for ''John Doe'', both ''John...
2006 May 26
1
Could not get all matched docs
Hi, I used Ferret to build an index and try to search here. But it looks like it always return only 10 matches results, event the return number of search_each is more than 10. Did I do something wrong? ------------------ n = index.search_each("ruby") do |doc, score| puts index[doc][''file''] end print n ------------------ I can only see 10 lines'' output. But n is 214 in the case. Thanks in advance for your help!...
2005 Nov 26
3
Get number of found documents
...ut I am not sure that statement index.search(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...
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