Displaying 11 results from an estimated 11 matches for "ferretconfig".
2005 Nov 26
3
Several questions about Ferret.
...found. Is such
document will be created??
What is the best practice to use Rails hooks for ferret?? I am tried to use
following code but it seems does not work correctly. Document indexed twice
after object update. Could you help me to write right Rails hook methods??
def after_save
index = FerretConfig::INDEX
index.remove(self.id.to_s)
index.update(self.id.to_s, self.to_document)
index.optimize
end
def before_destroy
index = FerretConfig::INDEX
index.remove(self.id.to_s)
index.optimize
end
def to_document
doc = Document.new
doc << Field.new('...
2006 Sep 25
0
Odd indexing issue
...Debian sarge. Below is a little console
script with output showing the oddness.
The relevant model code is at the bottom of this post, please let me
know if there''s anything else I can supply.
Sam
--------ruby script/console
Entry.create_ferret_index
index = Ferret::Index::Index.new(FerretConfig::INDEXOPTIONS)
# an arbitrary query to return all results from index
index.search_each("*", {:limit => 6000}) do |doc, score|
if docindex !~ /^\d*$/ then # show me ids that aren''t numeric
p doc.to_s + " " + docindex = index[doc][:id]
end
end
-----------
OUTPUT F...
2006 Jul 07
4
Help installing Ferret
...{RAILS_ROOT}/app/models/result.rb:15:in `count''
#{RAILS_ROOT}/app/controllers/search_controller.rb:25:in `get_results''
I''m beat,, I did everything I mostly understand what is happeneing on
the code.. But still nothing
Though at
require ''ferret''
module FerretConfig
include Ferret
INDEX = Index::Index.new(:path =>
''f:/home/jan/workspace/ferret_test/index'')
end
I just changed ''f:/home/jan/workspace/ferret_test/index'') to ''index''
since it is root in my folder and i''m on OSX tiger
--...
2005 Nov 26
3
Get number of found documents
...g to create pagination. Because site could have millions
of documents I need to create on page link something like
"Page #100". Rather usual situation.
But to create this links I need to know how many documents Ferret found in
index.
For now I am doing it with following code
index = FerretConfig::INDEX
index_size = index.search(query).size
@document_pages = Paginator.new self, index_size, PAGE_SIZE, page_num
But 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...
2008 May 09
1
Searcher Explain
...e I call it, I get
Segmentation Faults and it kills the process I have running my Rails site.
Has anyone else had this problem? Here is some code I am trying to use it
in...
search = Search.create(:query => query)
@quotations = []
searcher = Ferret::Search::Searcher.new("index") # FerretConfig::INDEX
bq = self.build_query(query) # Builds a Boolean Query
searcher.search_each(bq) {|doc, score|
@quotations << SearchResult.new(searcher[doc][:id],
searcher[doc][:quotation], searcher[doc][:author], score)
}
p searcher.explain(bq, @quotations[0].id).to_s
searcher.close
Thanks i...
2006 Jan 05
2
ActiveRecord callbacks not happening
Hi,
I have a model class like so:
class Candidate < ActiveRecord::Base
validates_presence_of :name
@@index = FerretConfig::INDEX
def self.after_destroy
puts "Ferret: after_destroy called"
@@index.query_delete("+id:#{self.id} +ferret_class:#{self.class.name}")
optimize_index
end
end
But when I delete a record, the after_destroy is never called. Nothing
shown on logs from the...
2007 Feb 10
7
Adding entry breaks index
...results (which just adds to the strangeness - anyway I need it to work
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....
2006 Mar 09
1
Missing fields in search result
...Analysis::WhiteSpaceAnalyzer.new)
SR = Index::IndexSearcher(:path => ''/home/gregor/wisa/index'',
:analyzer => Analysis::WhiteSpaceAnalyzer.new)
Storing:
# initial creation of a lucene index
def create_index
# our central INDEX
index = FerretConfig::INDEX
# get all Companies, iterate over and index them
companies = Company.find(:all)
for company in companies
doc = Document.new
doc << Field.new("id", company.id, Field::Store::YES,
Field::Index::UNTOKENIZED)
doc << Field.new(&quo...
2006 Aug 15
5
Ferret Segmentation Faults
Hi,
I am getting a number of segmentation faults using Ferret 0.9.5, Fedora
Core 5 and Ruby 1.8.4
I installed it with the recommended gem install ferret
and example segmentation fault creation line would be as follows:
@records = FerretConfig::INDEX.search("address_line_2:\"Dumbarton\"")
I am also using acts_as_ferret and rails 1.15 but think this is an issue
with ferret.
Any ideas?
Cheers,
Alastair
--
Posted via http://www.ruby-forum.com/.
2006 Jun 13
1
Obtaining write lock when trying to write index error
...index << to_ferret_document #
[RAILS_ROOT]/lib/searchable_model.rb:5:in `<<''
index.flush
index.optimize
index.close
end
def get_index
Ferret::Index::Index.new(:path => APP::CONFIG[:store_indexes_directory],
:analyzer => FerretConfig::CONTENT_ANALYZER,
:create_if_missing => true)
end
I supposed that working with index this way would be okay (according
to http://ferret.davebalmain.com/trac/wiki/HowTos), but it looks like
i''v missed some kind of top-secret ferret config parameter maybe o...
2007 Oct 29
0
Ferret - sorting results by score
...o then look
up their corresponding records in the database. The reason for this is
that the database records contain more information than I am storing in
the index. Any ideas? Code example below. Thanks in advance!
def index
if (params[:q])
@search_results = Array.new
index = FerretConfig::INDEX
index.search_each(params[:q]) do |doc, score|
@search_results << index[doc][:id]
end
@quotes = Quote.find(@search_results)
end
end
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message...