private LuceneQuery<Object, Object> addValuesAndCreateQuery(int pagesize)
      throws InterruptedException {
    region = createRegionAndIndex(RegionShortcut.PARTITION, "field1", "field2");
    final LuceneIndex index = luceneService.getIndex(INDEX_NAME, REGION_NAME);

    // Put two values with some of the same tokens
    String value1 = "one three";
    String value2 = "one two three";
    String value3 = "one@three";
    region.put("A", new TestObject(value1, value1));
    region.put("B", new TestObject(value2, value2));
    region.put("C", new TestObject(value3, value3));
    region.put("D", new TestObject(value1, value1));
    region.put("E", new TestObject(value2, value2));
    region.put("F", new TestObject(value3, value3));
    region.put("G", new TestObject(value1, value2));

    luceneService.waitUntilFlushed(INDEX_NAME, REGION_NAME, 60000, TimeUnit.MILLISECONDS);
    return luceneService.createLuceneQueryFactory().setPageSize(pagesize).create(INDEX_NAME,
        REGION_NAME, "one", "field1");
  }
This class contains tests of lucene queries that can fit
geode-lucene/src/integrationTest/java/org/apache/geode/cache/lucene/LuceneQueriesIntegrationTest.java