molten-trunk/molten5_withgrid/vendor/plugins/acts_as_ferret/lib/class_methods.rb
# Finds instances by searching the Ferret index. Terms are ANDed by default, use 
# OR between terms for ORed queries. Or specify +:or_default => true+ in the
# +:ferret+ options hash of acts_as_ferret.
#
# == options:
# offset::      first hit to retrieve (useful for paging)
# limit::       number of hits to retrieve, or :all to retrieve
#               all results
# lazy::        Array of field names whose contents should be read directly
#               from the index. Those fields have to be marked 
#               +:store => :yes+ in their field options. Give true to get all
#               stored fields. Note that if you have a shared index, you have 
#               to explicitly state the fields you want to fetch, true won't
#               work here)
# models::      only for single_index scenarios: an Array of other Model classes to 
#               include in this search. Use :all to query all models.
#
# +find_options+ is a hash passed on to active_record's find when
# retrieving the data from db, useful to i.e. prefetch relationships with
# :include or to specify additional filter criteria with :conditions.
#
# This method returns a +SearchResults+ instance, which really is an Array that has 
# been decorated with a total_hits attribute holding the total number of hits.
#
# Please keep in mind that the number of total hits might be wrong if you specify 
# both ferret options and active record find_options that somehow limit the result 
# set (e.g. +:num_docs+ and some +:conditions+).
Finds instances by searching the Ferret index. Terms are ANDed by default, use
OR between terms for ORed queries. Or specify +:or_default => true+ in the
+:ferret+ options hash of acts_as_ferret.



+find_options+ is a hash passed on to active_record's find when
retrieving the data from db, useful to i.e. prefetch relationships with
:include or to specify additional filter criteria with :conditions.

This method returns a +SearchResults+ instance, which really is an Array that has
been decorated with a total_hits attribute holding the total number of hits.

Please keep in mind that the number of total hits might be wrong if you specify
both ferret options and active record find_options that somehow limit the result
set .
Finds instances by searching the Ferret index . Terms are ANDed by default use OR between terms for ORed queries . Or specify + : or_default = > true + in the + : ferret + options hash of acts_as_ferret . + find_options + is a hash passed on to active_record ' s find when retrieving the data from db useful to i . e . prefetch relationships with : include or to specify additional filter criteria with : conditions . This method returns a + SearchResults + instance which really is an Array that has been decorated with a total_hits attribute holding the total number of hits . Please keep in mind that the number of total hits might be wrong if you specify both ferret options and active record find_options that somehow limit the result set .
def find_with_ferret(q, options = {}, find_options = {})
      total_hits, result = find_records_lazy_or_not q, options, find_options
      logger.debug "Query: #{q}\ntotal hits: #{total_hits}, results delivered: #{result.size}"
      return SearchResults.new(result, total_hits)
    end
def find_with_ferret ( q , options = { } , find_options = { } ) total_hits , result = find_records_lazy_or_not q , options , find_options logger . debug "Query: #{q}\ntotal hits: #{total_hits}, results delivered: #{result.size}" return SearchResults . new ( result , total_hits ) end
Finds instances by searching the Ferret index.
Finds instances by searching the Ferret index .
q
options
find_options