mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-17 10:17:41 +00:00
Merge pull request #1201 from sidheshenator/keywordsearch_output_consistency
Get consistent snippets across multiple runs
This commit is contained in:
commit
351bc652d9
@ -268,11 +268,7 @@ class LuceneQuery implements KeywordSearchQuery {
|
|||||||
q.setQuery(theQueryStr);
|
q.setQuery(theQueryStr);
|
||||||
q.setRows(MAX_RESULTS);
|
q.setRows(MAX_RESULTS);
|
||||||
|
|
||||||
if (snippets) {
|
q.setFields(Server.Schema.ID.toString());
|
||||||
q.setFields(Server.Schema.ID.toString());
|
|
||||||
} else {
|
|
||||||
q.setFields(Server.Schema.ID.toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
for (KeywordQueryFilter filter : filters) {
|
for (KeywordQueryFilter filter : filters) {
|
||||||
q.addFilterQuery(filter.toString());
|
q.addFilterQuery(filter.toString());
|
||||||
@ -438,6 +434,8 @@ class LuceneQuery implements KeywordSearchQuery {
|
|||||||
if (contentHighlights == null) {
|
if (contentHighlights == null) {
|
||||||
return "";
|
return "";
|
||||||
} else {
|
} else {
|
||||||
|
// Sort contentHighlights in order to get consistently same snippet.
|
||||||
|
contentHighlights.sort(null);
|
||||||
// extracted content is HTML-escaped, but snippet goes in a plain text field
|
// extracted content is HTML-escaped, but snippet goes in a plain text field
|
||||||
return EscapeUtil.unEscapeHtml(contentHighlights.get(0)).trim();
|
return EscapeUtil.unEscapeHtml(contentHighlights.get(0)).trim();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user