19 package org.sleuthkit.autopsy.keywordsearch;
22 import java.nio.file.Paths;
23 import java.util.List;
24 import org.apache.commons.lang.math.NumberUtils;
33 private static final String KWS_OUTPUT_FOLDER_NAME =
"keywordsearch";
34 private static final String KWS_DATA_FOLDER_NAME =
"data";
35 private static final String INDEX_FOLDER_NAME =
"index";
36 private static final String CURRENT_SOLR_VERSION =
"8";
37 private static final int CURRENT_SOLR_VERSION_INT = 8;
38 private static final String CURRENT_SOLR_SCHEMA_VERSION =
"2.3";
40 static String getCurrentSolrVersion() {
41 return CURRENT_SOLR_VERSION;
44 static String getCurrentSchemaVersion() {
45 return CURRENT_SOLR_SCHEMA_VERSION;
48 static Index findLatestVersionIndex(List<Index> allIndexes) {
49 for (Index index : allIndexes) {
50 if (index.getSolrVersion().equals(CURRENT_SOLR_VERSION) && index.getSchemaVersion().equals(CURRENT_SOLR_SCHEMA_VERSION)) {
58 String indexFolderName =
"solr" + CURRENT_SOLR_VERSION +
"_schema" + CURRENT_SOLR_SCHEMA_VERSION;
60 File targetDirPath = Paths.get(theCase.getModuleDirectory(), KWS_OUTPUT_FOLDER_NAME, KWS_DATA_FOLDER_NAME, indexFolderName, INDEX_FOLDER_NAME).toFile();
61 return new Index(targetDirPath.getAbsolutePath(), CURRENT_SOLR_VERSION, CURRENT_SOLR_SCHEMA_VERSION,
"", theCase.getName());
64 static Index identifyIndexToUse(List<Index> allIndexes) {
73 Index bestCandidateIndex = null;
74 double solrVerFound = 0.0;
75 double schemaVerFound = 0.0;
76 for (Index index : allIndexes) {
77 if (NumberUtils.toDouble(index.getSolrVersion()) > CURRENT_SOLR_VERSION_INT) {
82 if (NumberUtils.toDouble(index.getSolrVersion()) >= solrVerFound) {
84 if (NumberUtils.toDouble(index.getSchemaVersion()) >= schemaVerFound) {
85 bestCandidateIndex = index;
86 solrVerFound = NumberUtils.toDouble(index.getSolrVersion());
87 schemaVerFound = NumberUtils.toDouble(index.getSchemaVersion());
91 return bestCandidateIndex;
103 static String isFutureIndexPresent(List<Index> allIndexes) {
104 for (Index index : allIndexes) {
105 if (NumberUtils.toDouble(index.getSolrVersion()) > CURRENT_SOLR_VERSION_INT) {
107 return index.getSolrVersion();