Last active
December 14, 2015 12:09
-
-
Save emmanuelbernard/5084039 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private class Indexer { | |
public void consumes(Iterator<Tuple> entityTuples) { | |
while (Tuple tuple = entityTuples.next() != null) { | |
Entry entry = convertToEntry(tuple); | |
pushToExecutorQueue(entry); | |
} | |
//pushToExecutorQueue, execute method | |
public execute() { | |
DocumentBuilder db = sf.getDocumentBuilderForEntry( e ); | |
org.apache.luceneDocument transformation = db.buildDocument(db); | |
//apply sharding logic: | |
IndexManager targetIndex = sf.getIndexManager( ... ) | |
targetIndex.writeAsBatchWork( transformation ); | |
} | |
} | |
private static class Indexer implements Consumer { | |
private final SearchFactory sf; | |
//ctors | |
//invoked concurrently on some GridDialect implementations: | |
public void consume(Entry e) { | |
DocumentBuilder db = sf.getDocumentBuilderForEntry( e ); | |
org.apache.luceneDocument transformation = db.buildDocument(db); | |
//apply sharding logic: | |
IndexManager targetIndex = sf.getIndexManager( ... ) | |
targetIndex.writeAsBatchWork( transformation ); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment