mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-06 21:00:22 +00:00
Fix
This commit is contained in:
parent
36fc9f1d18
commit
553ca57c2c
@ -2513,11 +2513,29 @@ public class Server {
|
|||||||
* @throws SolrServerException
|
* @throws SolrServerException
|
||||||
*/
|
*/
|
||||||
private int queryNumFileChunks(long contentID) throws SolrServerException, IOException {
|
private int queryNumFileChunks(long contentID) throws SolrServerException, IOException {
|
||||||
String id = KeywordSearchUtil.escapeLuceneQuery(Long.toString(contentID));
|
final SolrQuery q = new SolrQuery();
|
||||||
final SolrQuery q
|
q.setQuery("*:*");
|
||||||
= new SolrQuery(Server.Schema.ID + ":" + id + Server.CHUNK_ID_SEPARATOR + "*");
|
String filterQuery = Schema.ID.toString() + ":" + KeywordSearchUtil.escapeLuceneQuery(Long.toString(contentID));
|
||||||
q.setRows(0);
|
q.addFilterQuery(filterQuery);
|
||||||
return (int) query(q).getResults().getNumFound();
|
q.setFields(Schema.NUM_CHUNKS.toString());
|
||||||
|
try {
|
||||||
|
SolrDocumentList solrDocuments = query(q).getResults();
|
||||||
|
if (!solrDocuments.isEmpty()) {
|
||||||
|
SolrDocument solrDocument = solrDocuments.get(0);
|
||||||
|
if (solrDocument != null) {
|
||||||
|
Object fieldValue = solrDocument.getFieldValue(Schema.NUM_CHUNKS.toString());
|
||||||
|
return (Integer)fieldValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception ex) {
|
||||||
|
// intentional "catch all" as Solr is known to throw all kinds of Runtime exceptions
|
||||||
|
logger.log(Level.SEVERE, "Error getting content from Solr. Solr document id " + contentID + ", query: " + filterQuery, ex); //NON-NLS
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ERROR: we should never get here
|
||||||
|
logger.log(Level.SEVERE, "Error getting content from Solr. Solr document id " + contentID + ", query: " + filterQuery); //NON-NLS
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user