class Ferret::Document

version of the document and add the new version of the document.
the document contained within the index. You need to delete the old
Note: that modifying a Document retrieved from the index will not modify
Ferret::Search::Searcher#doc or Ferret::Index::IndexReader#doc.
are not available in documents retrieved from the index, e.g.
Note: that fields which are not stored (see Ferret::Index::FieldInfos)
rating so that they are more likely to appear in search results.
You may, for example, want to boost products that have a higher user
document, making it more likely to appear at the top of search results.
you can increase the score of a match for queries that match a particular
The boost attribute makes a Document more important in the index. That is,
=== Boost
across the whole index instead.
should use the Ferret::Index::FieldInfos class to set field properties
that Fields don’t have any properties except for the boost property. You
textual values. If you are coming from a Lucene background you should note
A Document is a set of fields. Each field has a name and an array of
Documents are the unit of indexing and search.

def eql?(o)

Return true if the documents are equal, ie they have the same fields
def eql?(o)
  return (o.is_a? Document and (o.boost == @boost) and
          (self.keys == o.keys) and (self.values == o.values))
end

def initialize(boost = 1.0)

Create a new Document object with a boost. The boost defaults to 1.0.
def initialize(boost = 1.0)
  @boost = boost
end

def to_s

Create a string representation of the document
def to_s
  buf = ["Document {"]
  self.keys.sort_by {|key| key.to_s}.each do |key|
    val = self[key]
    val_str = if val.instance_of? Array then %{["#{val.join('", "')}"]}
              elsif val.is_a? Field then val.to_s
              else %{"#{val.to_s}"}
              end
    buf << "  :#{key} => #{val_str}"
  end
  buf << ["}#{@boost == 1.0 ? "" : "^" + @boost.to_s}"]
  return buf.join("\n")
end