FlatFormatSerializer (Apache Geode 1.9.1)
Date: 2019-08-30

org.apache.geode.cache.lucene

## Class FlatFormatSerializer

- java.lang.Object
- - org.apache.geode.cache.lucene.FlatFormatSerializer

- All Implemented Interfaces:
    Declarable, LuceneSerializer

      public class FlatFormatSerializer
      extends Object
      implements LuceneSerializer

  A built-in `LuceneSerializer` to parse user's nested object into a flat format, i.e. a single document. Each nested object will become a set of fields, with field name in format of contacts.name, contacts.homepage.title. Here is a example of usage: User needs to explicitly setLuceneSerializer with an instance of this class, and specify nested objects' indexed fields in following format: luceneService.createIndexFactory().setLuceneSerializer(new FlatFormatSerializer()) .addField("name").addField("contacts.name").addField("contacts.email", new KeywordAnalyzer()) .addField("contacts.address").addField("contacts.homepage.content") .create(INDEX_NAME, REGION_NAME); Region region = createRegion(REGION_NAME, RegionShortcut.PARTITION); When querying, use the same dot-separated index field name, such as contacts.homepage.content LuceneQuery query = luceneService.createLuceneQueryFactory().create(INDEX_NAME, REGION_NAME, "contacts.homepage.content:Hello*", "name"); results = query.findPages();

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `FlatFormatSerializer()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `Collection<Document>` | `toDocuments(LuceneIndex index, Object value)` Recursively serialize each indexed field's value into a field of lucene document.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface org.apache.geode.cache.Declarable

      `init, initialize`

- - ### Constructor Detail

    - #### FlatFormatSerializer

          public FlatFormatSerializer()

  - ### Method Detail

    - #### toDocuments

          public Collection<Document> toDocuments(LuceneIndex index,
                                                  Object value)

      Recursively serialize each indexed field's value into a field of lucene document. The field name will be in the same format as its indexed, such as contacts.homepage.content
      Specified by:
        `toDocuments` in interface `LuceneSerializer`
      Parameters:
        `index` - lucene index
        `value` - user object to be serialized into index