public IndexOperation( final String writeAlias, final ApplicationScope applicationScope, IndexEdge indexEdge, Entity entity, Optional<Set<String>> fieldsToIndex ) { this( writeAlias, IndexingUtils.createIndexDocId( applicationScope, entity, indexEdge ), EntityToMapConverter.convert( applicationScope, indexEdge, entity, fieldsToIndex ) ); }
/** * Generate our types to search on * @param applicationScope * @return */ public String[] getTypeNames( ApplicationScope applicationScope ) { String[] typeNames = new String[types.length]; for ( int i = 0; i < types.length; i++ ) { typeNames[i] = IndexingUtils.getType( applicationScope, types[i] ); } return typeNames; }
/** * if there are aliases then we must have an index...weak knowledge * @return */ private boolean shouldInitialize() { String[] writes = getIndexes(AliasType.Write); return writes.length==0; }
public DeIndexOperation( String[] indexes, ApplicationScope applicationScope, SearchEdge searchEdge, Id id, UUID version ) { this.indexes = indexes; this.documentId = createIndexDocId( applicationScope, id, version, searchEdge ); }
public static UUID getApplicationIdFromIndexDocId(String documentId) { return parseAppIdFromIndexDocId(documentId); } }
public static CandidateResult parseIndexDocId( final String documentId ) { return parseIndexDocId(documentId,-1); } /**
@Override public String toString() { return "IndexEdgeImpl{" + "timestamp=" + timestamp + "} " + super.toString(); } }
@Override public int hashCode() { int result = super.hashCode(); result = 31 * result + ( int ) ( timestamp ^ ( timestamp >>> 32 ) ); return result; }
/** * Get the client instnace */ public Client getClient() { if ( client == null ) { //synchronize on creating the client so we don't create too many createClient(); } return client; }
@Override public EntityIndexBatch createBatch() { EntityIndexBatch batch = new EsEntityIndexBatchImpl(indexLocationStrategy, this ); return batch; }
public CandidateResults search( final SearchEdge searchEdge, final SearchTypes searchTypes, final String query, final int limit, final int offset, final Map<String, Class> fieldsWithType, final boolean analyzeOnly ) { return search(searchEdge, searchTypes, query, limit, offset, fieldsWithType, analyzeOnly, false); }
/** * Parse the map field */ public Set<EntityField> parse(final Map<String, ?> map ) { iterate( map ); return fields; } }
@Override public String[] getIndexes(final AliasType aliasType) { return aliasCache.getIndexes(alias, aliasType); }
public static final String nodeId( final Id id ) { return idString( NODEID_NAME, id ); }
/** * Get the alias name * @return */ @Override public IndexAlias getAlias() { return new TestIndexAlias(indexFig,prefix); }
/** * Start the resources */ public void start() { before(); }
public TestIndexIdentifier(final CassandraFig cassandraFig, final IndexFig config, final ApplicationScope applicationScope) { this.cassandraFig = cassandraFig; this.indexFig = config; this.applicationScope = applicationScope; this.prefix = getPrefix(); }
@Override public String getIndexInitialName() { return getIndexRootName(); }
public static Entity fromMap( Map<String, Object> item ) { return fromMap( null, item ); }
public String[] getTypeNames(ApplicationScope applicationScope) { final String[] typeNames = new String[]{type , IndexingUtils.getType(applicationScope, type)}; return typeNames; } }