fix npe when a hit is in the file name and so the "parent" index entry is returned, which does not include a chunksize. Allways accept these hits.

This commit is contained in:
millmanorama 2017-01-25 12:28:05 +01:00
parent 3ada14c54d
commit adbc85f744
2 changed files with 3 additions and 3 deletions

View File

@ -223,8 +223,8 @@ class LuceneQuery implements KeywordSearchQuery {
final Integer chunkSize = (Integer) resultDoc.getFieldValue(Server.Schema.CHUNK_SIZE.toString());
final String content_str = resultDoc.get(Server.Schema.CONTENT_STR.toString()).toString();
Integer firstOccurence = content_str.indexOf(strippedQueryString);
if (firstOccurence < chunkSize) {
int firstOccurence = content_str.indexOf(strippedQueryString);
if (chunkSize != null && firstOccurence < chunkSize) {
matches.add(createKeywordtHit(highlightResponse, docId));
}
} catch (TskException ex) {

View File

@ -243,7 +243,7 @@ final class RegexQuery implements KeywordSearchQuery {
while (hitMatcher.find(offset)) {
StringBuilder snippet = new StringBuilder();
if (hitMatcher.start() >= chunkSize) {
if (chunkSize != null && hitMatcher.start() >= chunkSize) {
break;
}