Class: Ferret::Index::FieldInfos

Inherits:
Object
  • Object
show all
Defined in:
ext/isomorfeus_ferret_ext/frb_index.c

Overview

Summary

The FieldInfos class holds all the field descriptors for an index. It is this class that is used to create a new index using the FieldInfos#create_index method. If you are happy with the default properties for FieldInfo then you don’t need to worry about this class. FrtIndexWriter can create the index for you. Otherwise you should set up the index like in the example;

Example

field_infos = FieldInfos.new(:term_vector => :no)

field_infos.add_field(:title, :index => :untokenized, :term_vector => :no,
                      :boost => 10.0)

field_infos.add_field(:content)

field_infos.add_field(:created_on, :index => :untokenized_omit_norms,
                      :term_vector => :no)

field_infos.add_field(:image, :store => :yes, :compression => :brotli, :index => :no,
                      :term_vector => :no)

field_infos.create_index("/path/to/index")

Default Properties

See FieldInfo for the available field property values.

When you create the FieldInfos object you specify the default properties for the fields. Often you’ll specify all of the fields in the index before you create the index so the default values won’t come into play. However, it is possible to continue to dynamically add fields as indexing goes along. If you add a document to the index which has fields that the index doesn’t know about then the default properties are used for the new field.