On 8/24/06, Benjamin Krause <[EMAIL PROTECTED]> wrote:
> hey..
>
> >> it's as easy as doc[:title] = field
>
> thats quite easy.. indeed :)
>
> > NOTE: all fields should now be Symbols. Strings will work in most
> > cases but Symbols are what is expected. They're much more efficient
> > anyway.
>
> what if i add a field to a doc that was not initialized using fieldinfos?
> will this be added anyway and just fallback to the default fieldinfos?
> is there a way to prevent fields from beeing added if there is no
> fieldinfo definition? And if not, will there be a way?
>
> Thanks,
> Ben
Great question. Another thing I should elloborate on. When you create
the FieldInfos object you can set the default fields for any unknown
fields you add later. For example
fi = FieldInfos.new(:store => :no, :term_vector => :no)
# fields are normally stored by default but now we've set the default :store
# value to :no so we need to explicitly state that we want to store fields;
fi.add_fields(:title, :store => :yes, :index => :untokenized)
index = Index.new(:field_infos => fi)
index << {:title => "asdg", :content => "asdlkgjhasdkgjh"}
Cheers,
Dave
_______________________________________________
Ferret-talk mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/ferret-talk