mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-12 07:56:16 +00:00
add image_id to Solr schema
This commit is contained in:
parent
804991dc3b
commit
bc3ccd16a6
@ -505,6 +505,8 @@
|
||||
-->
|
||||
|
||||
<field name="id" type="string" indexed="true" stored="true" required="true" />
|
||||
<!-- use image_id to easily search a specific image only -->
|
||||
<field name="image_id" type="string" indexed="true" stored="true" required="true" />
|
||||
<!-- The content field holds the text extracted by SolrCell -->
|
||||
<field name="content" type="text_general" indexed="true" stored="true" termVectors="true" termPositions="true" termOffsets="true" />
|
||||
<!-- The strings field holds strings extracted from files that SolrCell doesn't support -->
|
||||
|
@ -54,6 +54,7 @@ import org.sleuthkit.datamodel.File;
|
||||
import org.sleuthkit.datamodel.FsContent;
|
||||
import org.sleuthkit.datamodel.LayoutFile;
|
||||
import org.sleuthkit.datamodel.ReadContentInputStream;
|
||||
import org.sleuthkit.datamodel.TskCoreException;
|
||||
|
||||
/**
|
||||
* Handles indexing files on a Solr core.
|
||||
@ -217,6 +218,12 @@ public class Ingester {
|
||||
private Map<String, String> getCommonFields(AbstractFile af) {
|
||||
Map<String, String> params = new HashMap<String, String>();
|
||||
params.put(Server.Schema.ID.toString(), Long.toString(af.getId()));
|
||||
try {
|
||||
params.put(Server.Schema.IMAGE_ID.toString(), Long.toString(af.getImage().getId()));
|
||||
} catch (TskCoreException ex) {
|
||||
logger.log(Level.SEVERE, "Could not get image id to properly index the file " + af.getId());
|
||||
}
|
||||
|
||||
params.put(Server.Schema.FILE_NAME.toString(), af.getName());
|
||||
return params;
|
||||
}
|
||||
@ -239,6 +246,14 @@ public class Ingester {
|
||||
* @throws org.sleuthkit.autopsy.keywordsearch.Ingester.IngesterException
|
||||
*/
|
||||
private void ingest(ContentStream cs, Map<String, String> fields, final long size) throws IngesterException {
|
||||
|
||||
if (fields.get(Server.Schema.IMAGE_ID.toString()) == null) {
|
||||
//skip the file, image id unknown
|
||||
String msg = "Skipping indexing the file, unknown image id, for file: " + cs.getName();
|
||||
logger.log(Level.SEVERE, msg);
|
||||
throw new IngesterException(msg);
|
||||
}
|
||||
|
||||
SolrInputDocument updateDoc = new SolrInputDocument();
|
||||
|
||||
for (String key : fields.keySet()) {
|
||||
|
@ -69,6 +69,12 @@ public class Server {
|
||||
return "id";
|
||||
}
|
||||
},
|
||||
IMAGE_ID {
|
||||
@Override
|
||||
public String toString() {
|
||||
return "image_id";
|
||||
}
|
||||
},
|
||||
CONTENT {
|
||||
@Override
|
||||
public String toString() {
|
||||
|
@ -56,7 +56,7 @@ public class TermComponentQuery implements KeywordSearchQuery {
|
||||
private Keyword keywordQuery = null;
|
||||
private KeywordQueryFilter filter = null;
|
||||
private String field = null;
|
||||
private static int MAX_TERMS_RESULTS = 10000;
|
||||
private static int MAX_TERMS_RESULTS = 20000;
|
||||
|
||||
private static final boolean DEBUG = (Version.getBuildType() == Version.Type.DEVELOPMENT);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user