Home » Java » java – how to obtain Explain object from solrj?-Exceptionshub

java – how to obtain Explain object from solrj?-Exceptionshub

Posted by: admin February 25, 2020 Leave a comment

Questions:

I’m switching from lucene to solr and I’m querying it with solrj.

After a query I’d like to obtain the explain and I executed this code:

        QueryResponse queryResult = solrClient.query(collection, query, POST);
        List<SolrDocument> recommended = queryResult.getResults();
        Map<String, String> explainMap = queryResult.getExplainMap();
        Map<String, Object> debugMap = queryResult.getDebugMap();

The explainMap contains the explanation of my query as a String.

Is it possible to obtain an object of explanation to avoid parsing the string?

For example I’d like to extract all the fields that matched and their value (without score and its composition).

My documents have only one textual field and many categorical or numeric fields.

How to&Answers: