def define_finder(finder_name)
      class_eval <<-end_eval
        def self.find_all_by_#{finder_name}(user_query, options={})
          options[:fields] ||= index_views_hash[:default]

          # quote the query if the field type is :string
          if finder_field = index_field(:#{finder_name})
            ([:string, :string_array].member?(finder_field.field_type)) ?
              query = "#{finder_name}:(\\"\#{user_query}\\")" : query = "#{finder_name}:(\#{user_query})"
          else
            query = user_query
          end

          if options[:format] == :ids
            index_adapter.find_ids_by_index(self, query, options)
          else
            index_adapter.find_by_index(self, query, options)
          end
        end

        def self.find_by_#{finder_name}(user_query, options={})
          find_all_by_#{finder_name}(user_query, options.merge({:limit => 1})).first
        end
      end_eval
    end
def define_finder(finder_name)
      class_eval <<-end_eval
        def self.find_all_by_#{finder_name}(user_query, options={})
          options[:fields] ||= index_views_hash[:default]

          # quote the query if the field type is :string
          if finder_field = index_field(:#{finder_name})
            ([:string, :string_array].member?(finder_field.field_type)) ?
              query = "#{finder_name}:(\\"\#{user_query}\\")" : query = "#{finder_name}:(\#{user_query})"
          else
            query = user_query
          end

          if options[:format] == :ids
            index_adapter.find_ids_by_index(self, query, options)
          else
            index_adapter.find_by_index(self, query, options)
          end
        end

        def self.find_by_#{finder_name}(user_query, options={})
          find_all_by_#{finder_name}(user_query, options.merge({:limit => 1})).first
        end
      end_eval
    end
Creates the attribute finder methods based on the indexed fields of the class,
 i.e. #find_by_#{attribute_name}