mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-16 17:57:43 +00:00
Merge pull request #2475 from millmanorama/2140
2140 Update artifact generation for Regex queries with overlapping chunks
This commit is contained in:
commit
92616368f0
@ -162,9 +162,9 @@ final class RegexQuery implements KeywordSearchQuery {
|
||||
|
||||
// Set the fields we want to have returned by the query.
|
||||
if (KeywordSearchSettings.getShowSnippets()) {
|
||||
solrQuery.setFields(Server.Schema.CONTENT_STR.toString(), Server.Schema.ID.toString());
|
||||
solrQuery.setFields(Server.Schema.CONTENT_STR.toString(), Server.Schema.ID.toString(), Server.Schema.CHUNK_SIZE.toString());
|
||||
} else {
|
||||
solrQuery.setFields(Server.Schema.ID.toString());
|
||||
solrQuery.setFields(Server.Schema.ID.toString(), Server.Schema.CHUNK_SIZE.toString());
|
||||
}
|
||||
filters.stream()
|
||||
.map(KeywordQueryFilter::toString)
|
||||
@ -217,6 +217,7 @@ final class RegexQuery implements KeywordSearchQuery {
|
||||
|
||||
List<KeywordHit> hits = new ArrayList<>();
|
||||
final String docId = solrDoc.getFieldValue(Server.Schema.ID.toString()).toString();
|
||||
final Integer chunkSize = (Integer) solrDoc.getFieldValue(Server.Schema.CHUNK_SIZE.toString());
|
||||
|
||||
String content = solrDoc.getOrDefault(Server.Schema.CONTENT_STR.toString(), "").toString(); //NON-NLS
|
||||
|
||||
@ -241,6 +242,11 @@ final class RegexQuery implements KeywordSearchQuery {
|
||||
|
||||
while (hitMatcher.find(offset)) {
|
||||
StringBuilder snippet = new StringBuilder();
|
||||
|
||||
if (hitMatcher.start() >= chunkSize) {
|
||||
break;
|
||||
}
|
||||
|
||||
String hit = hitMatcher.group();
|
||||
|
||||
// Back the matcher offset up by 1 character as it will have eaten
|
||||
|
Loading…
x
Reference in New Issue
Block a user