def find_ids(query, options = {})

      result = []
      stored_fields = determine_stored_fields options

      q = process_query(query, options)
      q = scope_query_to_models q, options[:models] #if shared?
      
      # Force q to be encoded as UTF-8 to avoid barfing when unicode passed in.
      # Was not an issue pre ruby 1.9.x force_encoding method is only available in ruby 1.9.x
      q_to_s = q.to_s.respond_to?('force_encoding') ? q.to_s.force_encoding('UTF-8') : q
      logger.debug "query: #{query}\n-->#{q_to_s}"
      s = searcher
      total_hits = s.search_each(q, options) do |hit, score|
        doc = s[hit]
        model = doc[:class_name]
        # fetch stored fields if lazy loading
        data = extract_stored_fields(doc, stored_fields)
        if block_given?
          yield model, doc[:id], score, data
        else
          result << { :model => model, :id => doc[:id], :score => score, :data => data }
        end
      end
      #logger.debug "id_score_model array: #{result.inspect}"
      return block_given? ? total_hits : [total_hits, result]
    end
def find_ids(query, options = {})

      result = []
      stored_fields = determine_stored_fields options

      q = process_query(query, options)
      q = scope_query_to_models q, options[:models] #if shared?
      
      # Force q to be encoded as UTF-8 to avoid barfing when unicode passed in.
      # Was not an issue pre ruby 1.9.x force_encoding method is only available in ruby 1.9.x
      q_to_s = q.to_s.respond_to?('force_encoding') ? q.to_s.force_encoding('UTF-8') : q
      logger.debug "query: #{query}\n-->#{q_to_s}"
      s = searcher
      total_hits = s.search_each(q, options) do |hit, score|
        doc = s[hit]
        model = doc[:class_name]
        # fetch stored fields if lazy loading
        data = extract_stored_fields(doc, stored_fields)
        if block_given?
          yield model, doc[:id], score, data
        else
          result << { :model => model, :id => doc[:id], :score => score, :data => data }
        end
      end
      #logger.debug "id_score_model array: #{result.inspect}"
      return block_given? ? total_hits : [total_hits, result]
    end
Queries the Ferret index to retrieve model class, id, score and the
 values of any fields stored in the index for each hit.
 If a block is given, these are yielded and the number of total hits is
 returned. Otherwise [total_hits, result_array] is returned.