Hi all.

In our team we thought about some tricky solution for queries with long time
highlighting. For example, highlighting that takes more than 25 seconds. So,
we created our component that wraps highlighting component of SOLR in this
way:

public void inform(SolrCore core) {
    . . . .
    subSearchComponent = core.getSearchComponent("highlight");
    . . . .
}

public void process(ResponseBuilder rb) throws Exception {
    long timeout = 25000;
    ExecutorService exec = null:
    try {
        exec = Executors.newSingleThreadExecutor();
        Future<IOException> future = exec.submit(() -> {
            try {
                subSearchComponent.process(rb);
            } catch (IOException e) {
                return e;
            } 
            return null;
        });
        Exception ex = future.get(timeout, TimeUnit.MILLISECONDS);
        if (ex != null) {
            throw ex;
        }
    } catch ( TimeoutException toe) {
        . . . .
    } catch (Exception e) {
       throw new IOException(e);
    } finally {
        if (exec != null) {
            exec.shutdownNow();
        }
    }
}

This solution works, but sometime we see that searchers stay open and as a
result our RAM usage is pretty high (like a memory leak of SolrIndexSearcher
objects). And only after a SOLR service restart they disappear.

What do you think about this solution?
Maybe exists some built-in function for it?



--
Sent from: https://lucene.472066.n3.nabble.com/Solr-User-f472068.html

Reply via email to