@Override public Collection<Document> toDocuments(LuceneIndex index, final Object value) { Document doc = new Document(); SerializerUtil.addField(doc, LuceneService.REGION_VALUE_FIELD, value); return Collections.singleton(doc); } }
private void addFieldValueForNonCollectionObject(Document doc, String indexedFieldName, Object fieldValue, List<String> tokenizedFields) { if (tokenizedFields.size() == 1) { SerializerUtil.addField(doc, indexedFieldName, fieldValue); } else { addFieldValue(doc, indexedFieldName, fieldValue, tokenizedFields.subList(1, tokenizedFields.size())); } }
@Override public Collection<Document> toDocuments(LuceneIndex index, Object value) { Document doc = new Document(); for (Field field : fields) { try { Object fieldValue = field.get(value); if (fieldValue == null) { continue; } SerializerUtil.addField(doc, field.getName(), fieldValue); } catch (IllegalArgumentException | IllegalAccessException e) { // TODO - what to do if we can't read a field? } } if (logger.isDebugEnabled()) { logger.debug("ReflectionLuceneSerializer.toDocument:" + doc); } return Collections.singleton(doc); } }
@Override public Collection<Document> toDocuments(LuceneIndex index, Object value) { Document doc = new Document(); PdxInstance pdx = (PdxInstance) value; for (String field : index.getFieldNames()) { if (pdx.hasField(field)) { Object fieldValue = pdx.getField(field); if (fieldValue == null) { continue; } SerializerUtil.addField(doc, field, fieldValue); } } if (logger.isDebugEnabled()) { logger.debug("PdxLuceneSerializer.toDocument:" + doc); } return Collections.singleton(doc); } }