public class MockSearchClient extends Object implements SearchClient
SearchClient that returns a preset response regardless of search request.
Documents can be preset by editing the documents field or calling add(com.attivio.sdk.search.SearchDocument...).
If more complicated responses are required the response field should be preset. Setting this
field invalidates any set documents (documents can be set directly in the response)| Modifier and Type | Field and Description |
|---|---|
SearchDocumentList |
documents
The preset documents to return
|
QueryResponse |
response
Preset
QueryResponse to return on any search request. |
DEFAULT_SEARCH_WORKFLOW, ENDPOINT| Constructor and Description |
|---|
MockSearchClient() |
| Modifier and Type | Method and Description |
|---|---|
void |
add(SearchDocument... docs)
Add documents to be returned on a search call
|
Schema |
getDefaultSchema()
Gets the schema named 'default' which is the most commonly one used throughout the system.
|
SearchDocument |
getDocumentById(String documentId)
Gets a document by a specific document Id
|
SearchDocumentList |
getDocuments() |
QueryResponse |
getResponse() |
Schema |
getSchema(String schemaName)
Get a named schema in the system or null if it does not exist.
|
void |
reset()
Clear the documents and/or response returned on a search call
|
QueryResponse |
search(QueryRequest query)
Sends the query to the Attivio search and returns the result.
|
StreamingQueryResponse |
search(StreamingQueryRequest req)
Sends the streaming query request to the Attivio search and returns the result.
|
QueryResponse |
search(String query)
Searches using a query string only.
|
void |
setClientWorkflow(String workflow)
Sets the default client workflow to use for this search client.
|
void |
setDocuments(SearchDocumentList documents) |
void |
setResponse(QueryResponse response) |
public SearchDocumentList documents
public QueryResponse response
QueryResponse to return on any search request.
This takes precendence over the documents field when setpublic void reset()
public void add(SearchDocument... docs)
docs - public SearchDocumentList getDocuments()
public void setDocuments(SearchDocumentList documents)
public QueryResponse getResponse()
public void setResponse(QueryResponse response)
public QueryResponse search(QueryRequest query)
SearchClientsearch in interface SearchClientquery - the query to sendpublic SearchDocument getDocumentById(String documentId)
SearchClientgetDocumentById in interface SearchClientdocumentId - ID of the document that will be returnedpublic QueryResponse search(String query)
SearchClientsearch in interface SearchClientquery - the query to usepublic Schema getDefaultSchema()
SearchClientgetDefaultSchema in interface SearchClientpublic Schema getSchema(String schemaName)
SearchClientgetSchema in interface SearchClientpublic void setClientWorkflow(String workflow)
SearchClientsetClientWorkflow in interface SearchClientworkflow - the workflow name to usepublic StreamingQueryResponse search(StreamingQueryRequest req)
SearchClientsearch in interface SearchClientreq - the streaming query request to sendCopyright © 2018 Attivio, Inc. All Rights Reserved.
PATENT NOTICE: Attivio, Inc. Software Related Patents. With respect to the Attivio software product(s) being used, the following patents apply: Querying Joined Data Within A Search Engine Index: United States Patent No.(s): 8,073,840. Ordered Processing of Groups of Messages: U.S. Patent No.(s) 8,495,656. Signal processing approach to sentiment analysis for entities in documents: U.S. Patent No.(s) 8,725,494. Other U.S. and International Patents Pending.