search for: num_doc

Displaying 20 results from an estimated 35 matches for "num_doc".

Did you mean: num_docs
2005 Nov 26
3
Get number of found documents
...t 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 part -----------...
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::VERSION idx =
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 Jul 19
4
sorting and pagination
...elds=> [''short_description'',...,''date_registered''] def VoObject.find_results(query,page) sort_fields = [] sort_fields << Ferret::Search::SortField.new("date_registered", :reverse => :false) results2 = VoObject.find_by_contents(query,:num_docs=> 2000000,:sort =>sort_fields ) num = results2.size if page == 1 page = 0 else page = (page-1)*20 end results = VoObject.find_by_contents(query,:first_doc=>page, :num_docs=> 20,:sort => sort_fields) [num,results,results2] end ############################## I ad...
2006 Jun 22
3
Partition results based on field
Hello all I''m using Ferret for a site wide search where I have several kinds of (similar) objects in a central index (using a "type" field containing the class name). This works great, and I can search all objects with one query. What I''d like to do now is to limit the results so that there will be a maximum of 10 (or 5 or whatever) results for each type.. I
2007 Feb 16
1
Bug in IndexSearcher with limit => all and any offset
Here''s the deal: static TopDocs *isea_search_w(Searcher *self, Weight *weight, int first_doc, // OFFSET int num_docs, // LIMIT Filter *filter, Sort *sort, filter_ft filter_func, bool load_fields) { int max_size = first_doc + num_docs; Actually, when you have limit => :all, num_docs equa...
2006 Aug 28
1
strange 10 limit
Hi, I have a max_results limit of 10, whatever value I pass to max_results, even if I drop this option in my class. Same limit using script/console Myclass.find_by_contents(query) Ideas ? Using aaf 9.5. Jean-Christophe Michel -- symetrie.com Better Nested Set for rails: http://opensource.symetrie.com/trac/better_nested_set
2006 Jul 12
5
Reverse sorting
I am getting strange results when I reverse sort a query. I am sorting by date, but it doesn''t seem to be related to dates (I have tried just integers). I also paginate the results. Items in the result set are sometimes duplicated and the not ordered at all. When I try a non-reverse sort I don''t see duplicates and the ordering is correct. Any ideas what is going on? Thanks
2013 Jul 03
2
Potential memory leak when assigning MSetItem values
...objects and running garbage collection. I think the MSetItems are preserved in memory and are not being garbage collected correctly, possibly from a lingering reference to the MSet or MSetIterator. import os import simplejson as json import xapian as x import shutil import gc def make_db(path, num_docs=100000): try: shutil.rmtree(path) except OSError, e: if e.errno != 2: raise db = x.WritableDatabase(path, x.DB_CREATE) for i in xrange(1, num_docs): doc = x.Document() doc.set_data(json.dumps({ 'id': i, 'enabled': True })...
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
2006 Aug 20
1
sorting with booleans
...i''m currently using. sort_fields = [] sort_fields << Ferret::Search::SortField.new("sponsorerd") sort_fields << Ferret::Search::SortField.new("ferret_date_registered", :reverse => :true) results = VoObject.find_by_contents(query,:first_doc=>page, :num_docs=> 20,:sort =>sort_fields) Thanks in advance for any replies. regards c -- Posted via http://www.ruby-forum.com/.
2006 Jul 10
11
Category Number Results returned
I am looking to have a number of categories populated from my results of a search. For example, searching on "sport" would display all results for sport. I want to also have a number of categories to refine the documents down. So by clicking on the "Fishing" category or the "Shooting" category, I would only see the results on sport around that category. Now for
2006 Mar 01
2
Sorting the Result
...w 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/.
2008 Mar 05
0
Index Searcher Causes GC Memory Error: "irb: double free or corruption"
...#{e.message}" # << e.backtrace.join("\n") return field_value end def doc_freq(field, term) self.searcher.doc_freq(field, term) end ############################# # Self Util methods def reader self.searcher.reader end def size if reader total_size = reader.num_docs else total_size = 0 self.sub_searchers.each do |sub_searcher| total_size += sub_searcher.reader.num_docs if sub_searcher.reader end return total_size end end alias :num_docs :size def close self.searcher.close end end
2006 Aug 30
7
AAF Sorting by date - what am I doing wrong?
...ve tried two different suggestions. This just returns results in the same order as a search without a sort: sort_fields = [] sort_fields << Ferret::Search::SortField.new("ferret_created_at",:reverse => :true) Comment.find_by_contents("test", :sort => sort_fields, :num_docs => 5) This also doesn''t affect the order: Comment.find_by_contents("test", :sort => ["ferret_created_at"], :num_docs => 5) The following, however, DOES affect the order, but it''s SUPER slow: Ferret::Search::SortField.new("id",:reverse =&g...
2006 Aug 02
4
Linking to the paginated items from search results.
Using Ferret for searching, I''ve got results that I need to link to. Which is fine, except for that they''re displayed on paginated pages using Rails paginate function - so it''s not like I can''t get it from the database or anything else. Anyone have any ideas on how to go about this? It''s not so much a coding problem as a theory problem, and I
2006 Oct 10
2
Ferret returning too many results
...aving trouble finding what could be causing this. any help greatly apreciated. relevant code from our rails app: # search_array hold an array of the model we want to search search_array.each do |asset| a = Object.const_get(asset) assets << (a.find_id_by_contents q, :limit => num_docs, :offset => first_doc) end assets.flatten! return assets -- Posted via http://www.ruby-forum.com/.
2006 Jul 29
2
Searches limited to 10 results?
Hello all, I''ve just recently gotten my ActiveRecord models indexed properly in my Rails App. Woohoo! So I''ve started testing some searches. Is there some limit to acts_as_ferret that only allows it to return 10 results? I''m searching for common terms in my data that I _know_ return many results, but I only ever get at most 10 results. This is in a db with 350k
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.
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 guessing the ''=>50''