public abstract class DocumentIndexer extends Object implements Indexer
| Modifier and Type | Field and Description |
|---|---|
protected org.apache.lucene.analysis.Analyzer |
analyzer
The analyzer.
|
protected static String |
DEFAULT_SEARCHABLE_FIELD
The Constant DEFAULT_SEARCHABLE_FIELD.
|
protected static int |
docNumber
The doc number.
|
protected static String |
INDEX_NAME
The INDEX_NAME.
|
private static org.slf4j.Logger |
LOG
log for this class.
|
protected static String |
SUPERCOLUMN_INDEX
The Constant SUPERCOLUMN_INDEX.
|
protected org.apache.lucene.analysis.Tokenizer |
tokenizer
The tokenizer.
|
private static long |
UUID
The Constant UUID.
|
| Constructor and Description |
|---|
DocumentIndexer()
Instantiates a new lucandra indexer.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
addEntityClassToDocument(EntityMetadata metadata,
Object entity,
org.apache.lucene.document.Document document,
MetamodelImpl metaModel)
Prepare index document.
|
protected void |
addEntityFieldsToDocument(EntityMetadata metadata,
Object entity,
org.apache.lucene.document.Document document,
MetamodelImpl metaModel)
Adds the index properties.
|
private void |
addFieldToDocument(Object object,
org.apache.lucene.document.Document document,
Field field,
String colName,
String indexName)
Index field.
|
protected void |
addParentKeyToDocument(String parentId,
org.apache.lucene.document.Document currentDoc,
Class<?> clazz)
Index parent key.
|
private void |
addSuperColumnNameToDocument(String superColumnName,
org.apache.lucene.document.Document currentDoc)
Index super column name.
|
protected void |
createSuperColumnDocument(EntityMetadata metadata,
Object object,
org.apache.lucene.document.Document currentDoc,
Object embeddedObject,
javax.persistence.metamodel.EmbeddableType superColumn,
MetamodelImpl metamodel)
Index super column.
|
protected String |
getCannonicalPropertyName(String indexName,
String propertyName)
Gets the cannonical property name.
|
protected String |
getKunderaId(EntityMetadata metadata,
Object id)
Gets the kundera id.
|
protected void |
indexCompositeKey(EntityMetadata metadata,
Object id,
org.apache.lucene.document.Document document,
MetamodelImpl metaModel)
index compositekey
|
protected abstract void |
indexDocument(EntityMetadata metadata,
org.apache.lucene.document.Document currentDoc)
Index document.
|
protected void |
indexSuperColumn(EntityMetadata metadata,
Object object,
org.apache.lucene.document.Document currentDoc,
Object embeddedObject,
javax.persistence.metamodel.EmbeddableType superColumn,
MetamodelImpl metamodel)
Index super column.
|
protected org.apache.lucene.document.Document |
prepareDocumentForSuperColumn(EntityMetadata metadata,
Object object,
String embeddedColumnName,
String parentId,
Class<?> clazz)
Prepare document.
|
Map<String,Object> |
search(String query,
Class<?> parentClass,
EntityMetadata parentMetadata,
Class<?> childClass,
EntityMetadata childMetadata,
Object entityId,
int start,
int count) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitclose, documentExistsInIndex, entityExistsInIndex, flush, index, index, search, unindex, updateprivate static final org.slf4j.Logger LOG
protected static final String INDEX_NAME
private static final long UUID
protected static final String DEFAULT_SEARCHABLE_FIELD
protected static final String SUPERCOLUMN_INDEX
protected static int docNumber
protected org.apache.lucene.analysis.Analyzer analyzer
protected org.apache.lucene.analysis.Tokenizer tokenizer
public DocumentIndexer()
analyzer - the analyzerprotected org.apache.lucene.document.Document prepareDocumentForSuperColumn(EntityMetadata metadata, Object object, String embeddedColumnName, String parentId, Class<?> clazz)
metadata - the metadataobject - the objectembeddedColumnName - the super column nameparentId - the parent idclazz - the clazzprotected void addParentKeyToDocument(String parentId, org.apache.lucene.document.Document currentDoc, Class<?> clazz)
parentId - the parent idcurrentDoc - the current docclazz - the clazzprotected void createSuperColumnDocument(EntityMetadata metadata, Object object, org.apache.lucene.document.Document currentDoc, Object embeddedObject, javax.persistence.metamodel.EmbeddableType superColumn, MetamodelImpl metamodel)
metadata - the metadataobject - the objectcurrentDoc - the current docembeddedObject - the embedded objectsuperColumn - the super columnmetamodel - protected void indexSuperColumn(EntityMetadata metadata, Object object, org.apache.lucene.document.Document currentDoc, Object embeddedObject, javax.persistence.metamodel.EmbeddableType superColumn, MetamodelImpl metamodel)
metadata - the metadataobject - the objectcurrentDoc - the current docembeddedObject - the embedded objectsuperColumn - the super columnmetamodel - private void addSuperColumnNameToDocument(String superColumnName, org.apache.lucene.document.Document currentDoc)
superColumnName - the super column namecurrentDoc - the current docprotected void addEntityFieldsToDocument(EntityMetadata metadata, Object entity, org.apache.lucene.document.Document document, MetamodelImpl metaModel)
metadata - the metadataentity - the objectdocument - the documentmetaModel - protected void indexCompositeKey(EntityMetadata metadata, Object id, org.apache.lucene.document.Document document, MetamodelImpl metaModel)
metadata - id - document - metaModel - protected void addEntityClassToDocument(EntityMetadata metadata, Object entity, org.apache.lucene.document.Document document, MetamodelImpl metaModel)
metadata - the metadataentity - the objectdocument - the documentprivate void addFieldToDocument(Object object, org.apache.lucene.document.Document document, Field field, String colName, String indexName)
object - the objectdocument - the documentfield - the fieldcolName - the col nameindexName - the index namepublic Map<String,Object> search(String query, Class<?> parentClass, EntityMetadata parentMetadata, Class<?> childClass, EntityMetadata childMetadata, Object entityId, int start, int count)
protected String getKunderaId(EntityMetadata metadata, Object id)
metadata - the metadataid - the idprotected String getCannonicalPropertyName(String indexName, String propertyName)
indexName - the index namepropertyName - the property nameprotected abstract void indexDocument(EntityMetadata metadata, org.apache.lucene.document.Document currentDoc)
metadata - the metadatacurrentDoc - the current docCopyright © 2014. All Rights Reserved.