Search in sources :

Example 16 with QueryResult

use of org.apache.nifi.provenance.search.QueryResult in project nifi-minifi by apache.

the class MiNiFiPersistentProvenanceRepository method queryEvents.

QueryResult queryEvents(final Query query, final NiFiUser user) throws IOException {
    final QuerySubmission submission = submitQuery(query, user);
    final QueryResult result = submission.getResult();
    while (!result.isFinished()) {
        try {
            Thread.sleep(100L);
        } catch (final InterruptedException ie) {
            Thread.currentThread().interrupt();
        }
    }
    if (result.getError() != null) {
        throw new IOException(result.getError());
    }
    logger.info("{} got {} hits", query, result.getTotalHitCount());
    return result;
}
Also used : QueryResult(org.apache.nifi.provenance.search.QueryResult) QuerySubmission(org.apache.nifi.provenance.search.QuerySubmission) IOException(java.io.IOException)

Aggregations

QueryResult (org.apache.nifi.provenance.search.QueryResult)16 Query (org.apache.nifi.provenance.search.Query)13 Test (org.junit.Test)12 HashMap (java.util.HashMap)9 QuerySubmission (org.apache.nifi.provenance.search.QuerySubmission)8 IOException (java.io.IOException)6 File (java.io.File)4 FlowFile (org.apache.nifi.flowfile.FlowFile)4 TestUtil.createFlowFile (org.apache.nifi.provenance.TestUtil.createFlowFile)4 IndexManager (org.apache.nifi.provenance.lucene.IndexManager)4 DataOutputStream (java.io.DataOutputStream)3 FileOutputStream (java.io.FileOutputStream)3 ArrayList (java.util.ArrayList)3 GZIPOutputStream (java.util.zip.GZIPOutputStream)3 HashSet (java.util.HashSet)2 CountDownLatch (java.util.concurrent.CountDownLatch)2 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)2 AtomicLong (java.util.concurrent.atomic.AtomicLong)2 NiFiUser (org.apache.nifi.authorization.user.NiFiUser)2 ProvenanceEventRecord (org.apache.nifi.provenance.ProvenanceEventRecord)2