Package com.yahoo.documentapi
Class SimpleVisitorDocumentQueue
- java.lang.Object
-
- com.yahoo.documentapi.VisitorDataHandler
-
- com.yahoo.documentapi.DumpVisitorDataHandler
-
- com.yahoo.documentapi.SimpleVisitorDocumentQueue
-
public class SimpleVisitorDocumentQueue extends DumpVisitorDataHandler
A simple document queue that queues up all results and automatically acks them.Retrieving the list is not thread safe, so wait until visitor is done. This is a simple class merely meant for testing.
- Author:
- Håkon Humberset
-
-
Field Summary
-
Fields inherited from class com.yahoo.documentapi.VisitorDataHandler
session
-
-
Constructor Summary
Constructors Constructor Description SimpleVisitorDocumentQueue()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.List<com.yahoo.document.Document>
getDocuments()
void
onDocument(com.yahoo.document.Document doc, long timestamp)
Called when a document is received.void
onRemove(com.yahoo.document.DocumentId docId)
Called when a remove is received.void
reset()
Called before the visitor starts.-
Methods inherited from class com.yahoo.documentapi.DumpVisitorDataHandler
onMessage
-
Methods inherited from class com.yahoo.documentapi.VisitorDataHandler
ack, getNext, getNext, onDone, setSession
-
-
-
-
Method Detail
-
reset
public void reset()
Description copied from class:VisitorDataHandler
Called before the visitor starts. Override this method if you need to reset local data. Remember to call the superclass' method as well.- Overrides:
reset
in classVisitorDataHandler
-
onDocument
public void onDocument(com.yahoo.document.Document doc, long timestamp)
Description copied from class:DumpVisitorDataHandler
Called when a document is received. May be called from multiple threads concurrently.- Specified by:
onDocument
in classDumpVisitorDataHandler
- Parameters:
doc
- The document foundtimestamp
- The time when the document was stored.
-
onRemove
public void onRemove(com.yahoo.document.DocumentId docId)
Description copied from class:DumpVisitorDataHandler
Called when a remove is received. May be called from multiple threads concurrently.- Specified by:
onRemove
in classDumpVisitorDataHandler
- Parameters:
docId
- The document id that was removed.
-
getDocuments
public java.util.List<com.yahoo.document.Document> getDocuments()
- Returns:
- a list of all documents retrieved so far
-
-