Fixed issue where search did not match exact the complete URL and added support for multi-word search strings
This commit is contained in:
parent
a679c6d1a2
commit
7f3a4e7343
3 changed files with 17 additions and 6 deletions
|
@ -52,10 +52,10 @@ public class HistoryItemController implements Initializable {
|
|||
searchString = searchString.toLowerCase();
|
||||
String comparisonString;
|
||||
|
||||
// Checks if matches with HTTP method
|
||||
comparisonString = dashboardState.getHttpMethod().toLowerCase();
|
||||
// Checks if matches with target
|
||||
comparisonString = dashboardState.getTarget().toString().toLowerCase();
|
||||
if (comparisonString.contains(searchString))
|
||||
return 7;
|
||||
return 10;
|
||||
|
||||
// Checks if matches with target's hostname
|
||||
comparisonString = dashboardState.getTarget().getHost().toLowerCase();
|
||||
|
@ -67,6 +67,11 @@ public class HistoryItemController implements Initializable {
|
|||
if (comparisonString.contains(searchString))
|
||||
return 9;
|
||||
|
||||
// Checks if matches with HTTP method
|
||||
comparisonString = dashboardState.getHttpMethod().toLowerCase();
|
||||
if (comparisonString.contains(searchString))
|
||||
return 7;
|
||||
|
||||
// Checks for a match in the params
|
||||
for (Map.Entry param : dashboardState.getParams().entrySet()) {
|
||||
if (param.getKey().toString().toLowerCase().contains(searchString) ||
|
||||
|
|
|
@ -262,7 +262,15 @@ public class HomeWindowController implements Initializable {
|
|||
List<HistoryItemController> filteredList = new ArrayList<>();
|
||||
|
||||
for (HistoryItemController controller : historyItemControllers) {
|
||||
if (controller.getRelativityIndex(searchString) != 0)
|
||||
|
||||
int relativityIndex = 0;
|
||||
|
||||
// Split the string into words and get total relativity index as sum of individual indices.
|
||||
String words[] = searchString.split("\\s");
|
||||
for (String word : words)
|
||||
relativityIndex += controller.getRelativityIndex(word);
|
||||
|
||||
if (relativityIndex != 0)
|
||||
filteredList.add(controller);
|
||||
}
|
||||
|
||||
|
|
|
@ -200,8 +200,6 @@ public class HistoryManager {
|
|||
}
|
||||
} catch (SQLException e) {
|
||||
Services.loggingService.logWarning("Database error.", e, LocalDateTime.now());
|
||||
} finally {
|
||||
System.out.println("Saved history item to database.");
|
||||
}
|
||||
}, "History Saver Thread").start();
|
||||
|
||||
|
|
Loading…
Reference in a new issue