public List < EnhanceEntity > readFromIndexTable ( EntityMetadata m , Client client , Map < Boolean , List < IndexClause > > indexClauseMap ) { List < SearchResult > searchResults = new ArrayList < SearchResult > ( ) ; List < Object > primaryKeys = new ArrayList < Object > ( ) ; String columnFamilyName = m . getTableName ( ) + Constants . INDEX_TABLE_SUFFIX ; searchResults = ( ( CassandraClientBase ) client ) . searchInInvertedIndex ( columnFamilyName , m , indexClauseMap ) ; Map < String , String > embeddedColumns = new HashMap < String , String > ( ) ; for ( SearchResult searchResult : searchResults ) { if ( searchResult . getEmbeddedColumnValues ( ) != null ) { for ( String embeddedColVal : searchResult . getEmbeddedColumnValues ( ) ) { if ( embeddedColVal != null ) { StringBuilder strBuilder = new StringBuilder ( embeddedColVal ) ; strBuilder . append ( "|" ) ; strBuilder . append ( searchResult . getPrimaryKey ( ) . toString ( ) ) ; embeddedColumns . put ( strBuilder . toString ( ) , searchResult . getPrimaryKey ( ) . toString ( ) ) ; } } } } List < EnhanceEntity > enhanceEntityList = new ArrayList < EnhanceEntity > ( ) ; if ( embeddedColumns != null && ! embeddedColumns . isEmpty ( ) ) { enhanceEntityList = client . find ( m . getEntityClazz ( ) , embeddedColumns ) ; } else { for ( SearchResult searchResult : searchResults ) { primaryKeys . add ( searchResult . getPrimaryKey ( ) ) ; } enhanceEntityList = ( List < EnhanceEntity > ) ( ( CassandraClientBase ) client ) . find ( m . getEntityClazz ( ) , m . getRelationNames ( ) , true , m , primaryKeys . toArray ( new String [ ] { } ) ) ; } return enhanceEntityList ; }
Read from index table .