gedi-geode-extensions-core/src/main/java/gedi/solutions/geode/lucene/GeodeLuceneSearch.java
public Collection<String>  saveSearchResultsWithPageKeys(TextPageCriteria criteria, Region<String,Collection<?>> pageKeysRegion)
	{
		if(criteria == null)
			return null;
		
		if(criteria.getQuery() == null || criteria.getQuery().length() == 0)
			return null;
		
		if(criteria.getIndexName() == null || criteria.getIndexName().length() == 0)
			throw new IllegalArgumentException("Default criteria's indexName is required");
		
		if(criteria.getId() == null || criteria.getId().length() == 0)
			throw new IllegalArgumentException("Default criteria's id is required");
		
		if(criteria.getDefaultField() == null || criteria.getDefaultField().length() == 0)
			throw new IllegalArgumentException("Default criteria's defaultField is required");
			
		try
		{	
			
			LuceneQuery<Object, Object> luceneQuery = luceneService.createLuceneQueryFactory()
			  .create(criteria.getIndexName(), 
			  criteria.getRegionName(), 
			  criteria.getQuery(), criteria.getDefaultField());
			
			 List<LuceneResultStruct<Object, Object>> list = luceneQuery.findResults();
			 
			 luceneQuery.findPages();
			 
			 if(list == null || list.isEmpty())
				 return null;
			
			 String sortField =  criteria.getSortField();
			 BeanComparator beanComparator = null;
			 
			 Collection<Map.Entry<Object,Object>> results = null;
			 if(sortField != null && sortField.trim().length() > 0 )
			 {
				 beanComparator = new BeanComparator(sortField,criteria.isSortDescending());
				 
				 Collection<Map.Entry<Object,Object>> set = new TreeSet<Map.Entry<Object,Object>>(beanComparator);
				 list.parallelStream().forEach(e -> set.add(new MapEntry<Object,Object>(e.getKey(), e.getValue())));
				 results = set;
			 }
			 else
			 {
				 results = list.stream().map( e -> new MapEntry<>(e.getKey(), e.getValue())).collect(Collectors.toList());
			 }
			
			 
			 //add to pages
			 List<Collection<Object>> pagesCollection = Organizer.toKeyPages(results, criteria.getEndIndex() - criteria.getBeginIndex());
		 
			 int pageIndex = 0;
			 String key = null;
			 ArrayList<String> keys = new ArrayList<String>(10);
			 for (Collection<Object> page : pagesCollection)
			{
				 //store in region
				 key = new StringBuilder().append(criteria.getId()).append("-").append(pageIndex++).toString();
				 
				 pageKeysRegion.put(key, page);
				 
				 keys.add(key);
			}
			 
			 keys.trimToSize();
			 
			 return keys;
	
		}
		catch (LuceneQueryException e)
		{
			throw new SystemException(e);
		}		
	}
public Collection<String>  saveSearchResultsWithPageKeys(TextPageCriteria criteria, Region<String,Collection<?>> pageKeysRegion)
	{
		if(criteria == null)
			return null;
		
		if(criteria.getQuery() == null || criteria.getQuery().length() == 0)
			return null;
		
		if(criteria.getIndexName() == null || criteria.getIndexName().length() == 0)
			throw new IllegalArgumentException("Default criteria's indexName is required");
		
		if(criteria.getId() == null || criteria.getId().length() == 0)
			throw new IllegalArgumentException("Default criteria's id is required");
		
		if(criteria.getDefaultField() == null || criteria.getDefaultField().length() == 0)
			throw new IllegalArgumentException("Default criteria's defaultField is required");
			
		try
		{	
			
			LuceneQuery<Object, Object> luceneQuery = luceneService.createLuceneQueryFactory()
			  .create(criteria.getIndexName(), 
			  criteria.getRegionName(), 
			  criteria.getQuery(), criteria.getDefaultField());
			
			 List<LuceneResultStruct<Object, Object>> list = luceneQuery.findResults();
			 
			 luceneQuery.findPages();
			 
			 if(list == null || list.isEmpty())
				 return null;
			
			 String sortField =  criteria.getSortField();
			 BeanComparator beanComparator = null;
			 
			 Collection<Map.Entry<Object,Object>> results = null;
			 if(sortField != null && sortField.trim().length() > 0 )
			 {
				 beanComparator = new BeanComparator(sortField,criteria.isSortDescending());
				 
				 Collection<Map.Entry<Object,Object>> set = new TreeSet<Map.Entry<Object,Object>>(beanComparator);
				 list.parallelStream().forEach(e -> set.add(new MapEntry<Object,Object>(e.getKey(), e.getValue())));
				 results = set;
			 }
			 else
			 {
				 results = list.stream().map( e -> new MapEntry<>(e.getKey(), e.getValue())).collect(Collectors.toList());
			 }
			
			 
			 //add to pages
			 List<Collection<Object>> pagesCollection = Organizer.toKeyPages(results, criteria.getEndIndex() - criteria.getBeginIndex());
		 
			 int pageIndex = 0;
			 String key = null;
			 ArrayList<String> keys = new ArrayList<String>(10);
			 for (Collection<Object> page : pagesCollection)
			{
				 //store in region
				 key = new StringBuilder().append(criteria.getId()).append("-").append(pageIndex++).toString();
				 
				 pageKeysRegion.put(key, page);
				 
				 keys.add(key);
			}
			 
			 keys.trimToSize();
			 
			 return keys;
	
		}
		catch (LuceneQueryException e)
		{
			throw new SystemException(e);
		}		
	}
------------------------------------------------