Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

 

<cache
    xsi:schemaLocation="http://geode.apache.org/schema/cache
        http://geode.apache.org/schema/cache/cache-1.0.xsd
        http://geode.apache.org/schema/lucene
        http://geode.apache.org/schema/lucene/lucene-1.0.xsd"
    version="1.0">
 
    <region name="region" refid="PARTITION">
        <lucene:index name="index">
           <lucene:field name="a" analyzer="org.apache.lucene.analysis.core.KeywordAnalyzer"/>
           <lucene:field name="b" analyzer="org.apache.lucene.analysis.core.SimpleAnalyzer"/>
           <lucene:field name="c" analyzer="org.apache.lucene.analysis.standard.ClassicAnalyzer"/>
<lucene:serializer>
<class-name>org.apache.geode.cache.lucene.test.MySerializer</class-name>
</lucene:serializer>
       </lucene:index>
    </region>
</cache>

 

 

We will also provide a built-in implementation for LuceneSerializer called FlatFormatSeralizer(). With this example serializer users can specify nested fields using the syntax fieldnameAtLevel1.fieldnameAtLevel2 for both indexing and querying. 

For example, in the following example the data model Customer object contains both a Person object and a collection of Page objects. The Person object also contains a Page object.

Code Block
public class Customer implements Serializable {
  private String name;
  private Collection<String> phoneNumbers;
  private Collection<Person> contacts;
  private Page[] myHomePages;
  ......
}
public class Person implements Serializable {
  private String name;
  private String email;
  private int revenue;
  private String address;
  private String[] phoneNumbers;
  private Page homepage;
  .......
}
public class Page implements Serializable {
  private int id; // search integer in int format
  private String title;
  private String content;
  ......
}

 

The following example below demonstrates how to index the nested fields: contacts.name, contacts.email, contacts.address, contacts.homepage.title.

...