19 package org.sleuthkit.autopsy.keywordsearch;
35 private final String solrDocumentId;
36 private final long solrObjectId;
37 private final int chunkId;
38 private final String snippet;
39 private final Content content;
40 private final BlackboardArtifact artifact;
42 KeywordHit(String solrDocumentId, String snippet)
throws TskCoreException {
46 this.solrDocumentId = solrDocumentId;
57 final int separatorIndex = solrDocumentId.indexOf(Server.ID_CHUNK_SEP);
58 if (-1 != separatorIndex) {
59 this.solrObjectId = Long.parseLong(solrDocumentId.substring(0, separatorIndex));
60 this.chunkId = Integer.parseInt(solrDocumentId.substring(separatorIndex + 1));
62 this.solrObjectId = Long.parseLong(solrDocumentId);
71 SleuthkitCase caseDb = Case.getCurrentCase().getSleuthkitCase();
73 if (this.solrObjectId < 0) {
74 this.artifact = caseDb.getBlackboardArtifact(this.solrObjectId);
75 fileId = artifact.getObjectID();
78 fileId = this.solrObjectId;
80 this.content = caseDb.getContentById(fileId);
85 this.snippet = snippet;
88 String getSolrDocumentId() {
89 return this.solrDocumentId;
92 long getSolrObjectId() {
93 return this.solrObjectId;
96 boolean hasChunkId() {
97 return this.chunkId != 0;
104 boolean hasSnippet() {
105 return !this.snippet.isEmpty();
108 String getSnippet() {
112 Content getContent() {
116 boolean isArtifactHit() {
117 return (null != this.artifact);
120 BlackboardArtifact getArtifact() {
121 return this.artifact;
125 public boolean equals(Object obj) {
129 if (getClass() != obj.getClass()) {
132 final KeywordHit other = (KeywordHit) obj;
133 return (this.solrObjectId == other.solrObjectId &&
this.chunkId == other.chunkId);
137 public int hashCode() {
139 hash = 41 * hash + (int) this.solrObjectId + this.chunkId;