Displaying 20 results from an estimated 37 matches for "to_doc".
2006 Nov 28
4
Update/Create record only if field is true
I have a sellable flag in my database. I''m trying to have ferret only
add/update records where sellable == true. What is the best way to do
this? I''ve tried editing instance_methods.rb in the AAF, but I still
can''t get it to work.
Thanks for the help
--
Posted via http://www.ruby-forum.com/.
2006 Sep 18
16
Dynamic fields and AAF
Hi,
I have a model which has properties, these are your standard name/value
pairs, but also have attributes that affect how I want to store them in
ferret. I was using 0.9.5 with 0.2 of aaf, which seemed fine, I just
copied and pasted (yes, I know, ick) the to_doc method and added code to
iterate though the properties that that model had, and add relavent
fields to the document.
It seems that this will be a bit harder now with the FieldInfos. Has
anyone else done this, and is there a recognised way of doing it?
David
--
Posted via http://www.ruby-foru...
2006 May 24
10
Ferret slow after a while
...ironment.rb''
require ''ferret''
index = Ferret::Index::Index.new( :path => Node.class_index_dir, :create
=> true)
Node.find_all_by_type("PageNode").each { |content|
puts "ID: #{content.id} => name: #{content.title}"
index << content.to_doc if content.respond_to?("to_doc")
}
index.flush
index.optimize
index.close
--
Posted via http://www.ruby-forum.com/.
2006 Oct 05
4
search results autocompletion
...ces. Here is the code:
class Suggestion
attr_accessor :term
def self.index(create)
[Person, Project, Orgunit].each{|kl|
terms = self.all_terms(kl)
terms.each{|term|
suggestion = Suggestion.new
suggestion.term = term
SUGGESTION_INDEX << suggestion.to_doc
}
}
SUGGESTION_INDEX.optimize
end
def self.all_terms(klass)
reader = Index::IndexReader.new(Object.const_get(klass.name.upcase +
"_INDEX_DIR"))
terms = []
begin
reader.field_names.each {|field_name|
term_enum = reader.terms(field_name)
begin...
2006 Mar 01
9
Updating Index Is Very Slow
...ably less than
100 docs in it.
I have created my index as follows:
GIFT_INDEX = Index::Index.new(:path => "#{index_dir}/gift", :key =>
''id'', :auto_flush => true)
and I have an after_save filter in my model as follows:
def update_index
INDEX << self.to_doc
end
Is there anything I can do to improve this performance?
Thanks,
Tom
2006 Jul 07
0
acts_as_ferret transactions
...ansaction = false
def ferret_before_update
@ferret_reindex = true
@@ -505,9 +506,13 @@
# add to index
def ferret_create
- logger.debug "ferret_create/update: #{self.class.name} :
#{self.id}"
- self.class.ferret_index << self.to_doc if @ferret_reindex
- @ferret_reindex = true
+ unless @defer_for_transaction
+ logger.debug "ferret_create/update: #{self.class.name} :
#{self.id}"
+ self.class.ferret_index << self.to_doc if @ferret_reindex
+ @ferret_reindex = true...
2006 May 30
3
Rebuild Indexes Issue
...s to manually delete the index files
from the filesystem. Here is the code I have for rebuilding one of my
indexes for Gifts:
# delete existing entries
INDEX.size.times {|i| INDEX.delete(i)}
gifts = Gift.find(:all)
if (gifts)
gifts.each do |e|
INDEX << self.to_doc
end
end
INDEX.flush()
Does this look ok? I have verified this behavior on Ferret 0.3.2 and
0.9 on windows.
Thanks,
Tom Davies
http://blog.atomgiant.com
http://gifthat.com
2005 Dec 02
43
ANN: acts_as_ferret
...index ||= Index::Index.new(:key => :id,
:path => INDEX_DIR,
:create_if_missing => true,
:default_field => "*")
index << self.to_doc
index.optimize()
index.close()
end
def ferret_update
#code to update index
index ||= Index::Index.new(:key => :id,
:path => INDEX_DIR,...
2005 Dec 02
43
ANN: acts_as_ferret
...index ||= Index::Index.new(:key => :id,
:path => INDEX_DIR,
:create_if_missing => true,
:default_field => "*")
index << self.to_doc
index.optimize()
index.close()
end
def ferret_update
#code to update index
index ||= Index::Index.new(:key => :id,
:path => INDEX_DIR,...
2007 Nov 11
5
undefined method `add''
We''ve been running into problems with ferret indexing lately. The
problem is intermittent and some times it persists. Just got this after
wiping the index and redeploying:
NoMethodError (undefined method `add'' for Solution:Class):
(druby://10.1.65.87:9009)
/data/releases/20071111152414/vendor/rails/activerecord/lib/active_record/base.rb:1238:in
`method_missing''
2006 Nov 28
8
how to update index from a script
Hello all,
I''m using AAF right now to index my ~3million db records. However, any
additions to these records are added to the database through an external
script so the aaf activerecord hooks will not catch any updates. Since
new records are only added rarely, I figured I could just add the new
records manually in ferret from some type of script. I''ve been looking
at the
2007 Jun 13
14
Do delegates work properly in Drb mode?
Hi folks,
I have several models that index well in Drb mode.
However, I have one scenario where it works in normal mode, but not in
Drb mode.
model A
field :one
end
model B
belongs_to :a
field :two
delegate :one, :to => :a
acts_as_ferret :fields => { :one => {}, :two => {} }, :remote => true
end
If I leave off the :remote parameter, it works. Or, if I don''t
2007 Mar 06
1
in acts_as_ferret, excluding records from rebuild_index
Is there any way for the automatic ''rebuild_index'' of ''acts_as_ferret''
from exclude certain records from being included in the index?
--
Posted via http://www.ruby-forum.com/.
2006 Oct 11
1
Document Boost in acts_as_ferret?
Is it possible to set a boost value for a document using
acts_as_ferret (not field boost - document boost)?
2006 May 23
13
acts_as_ferret 0.2.1 segfault
...>nil}, @new_record=true>
>> a.save
./script/../config/../config/../vendor/plugins/acts_as_ferret/lib/acts_as_ferret.rb:466:
[BUG] Segmentation fault
ruby 1.8.4 (2005-12-24) [i386-linux]
vendor/plugins/acts_as_ferret/lib/acts_as_ferret.rb:466 reads:
self.class.ferret_index << self.to_doc if @ferret_reindex
by inserting logger.debug statements I have been able to determine that
self.to_doc isn''t the problem so I think it must be segfaulting during the
<<.
Does someone know if I have set up something improperly, or is this truly a
bug?
Thanks,
John
-------------- next...
2006 May 18
2
acts_as_ferret 0.2.1
...earch across all
inheriting classes, see TypoWithFerret for an example)
* Aaf is not limited to indexing the attributes of your model: You can
tell it to index the result of any instance method of your model class.
* Further customization of the indexing process can be achieved by
overriding the to_doc instance method in your model class, which is
supposed to return the Ferret document object to be stored in the index.
* Use my_model_instance#more_like_this to retrieve objects having
similar contents like my_model_instance. Great for suggesting related
pages to your readers, or related product...
2006 Aug 04
5
A couple of ferret 0.9.4 exceptions
...39;'t
too bad). I am using two lighttpd instances both with read/write
access to the index:
1) Error occured at <fs_store.c>:318
Error: exception 2 not handled: Couldn''t open the file to read
This happened while adding a document to the index like so:
gift_index << self.to_doc
2) Error occured at <index_rw.c>:2642
Error: exception 6 not handled: Could not obtain commit lock when
trying to write index
This happened while doing a search_each like so:
gift_index.search_each
The weird thing is that I would think the search each doesn''t need to
write to the...
2007 Jun 07
5
Advise on slowness in bootstrapping?
I am looking at trying to use ferret/aaf to supplement my querying against a
medium and large table with lots of columns. Some facts first:
Ferret 0.11.4
AAF 0.4.0
Ruby 1.8.6
Rails 1.2.3
Medium table:
105,464 rows
168 columns (mostly varchar(20))
11 actual columns indexed in aaf plus
40 virtual columns indexed in aaf (virtual is concat of two physical columns.
e.g. cast_first_name_1 +
2006 Jul 31
16
Sorting performance
I''m using acts_as_ferret to index one of my rails models. Right after I
start the app the first request that orders by some ferret field will
take very long. Subsequent ones seem to be fast. I guess some caching is
going on. Any tips on solving this?
Pedro.
2006 Sep 20
2
bad interaction of ferret (0.10.5) and mongrel on linux
...s the site via the web and try to modify a document
that triggers indexing, I get the following error:
A NoMethodError occurred in questions#update_faq:
undefined method `new'' for Ferret::Document:Module
[RAILS_ROOT]/vendor/plugins/acts_as_ferret/lib/instance_methods.rb:
110:in `to_doc''
When I try to run a search, I get no results at all even though the
documents are indexed. (I can run searches fine from the Rails console.)
Anyone ever seen anything like this? I have no idea what it is
about the ferret/mongrel/Linux combination that''s causing these...