From 9eb58020d7ccaa2c3d3ef355a4ac935e9bcb962c Mon Sep 17 00:00:00 2001 From: Vishal <64505169+vishalxl@users.noreply.github.com> Date: Tue, 30 Aug 2022 20:22:21 +0530 Subject: [PATCH] added search by event id, along with search by word --- lib/console_ui.dart | 2 +- lib/event_ds.dart | 2 +- lib/tree_ds.dart | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/console_ui.dart b/lib/console_ui.dart index 3708744..a014466 100644 --- a/lib/console_ui.dart +++ b/lib/console_ui.dart @@ -161,7 +161,7 @@ Future otherMenuUi(Tree node, var contactList) async { int option = showMenu([ 'Show user profile', // 1 'Display contact list', // 2 'Follow new contact', // 3 - 'Search word(s)', // 4 + 'Search word(s) or event id', // 4 'Search by client name', // 5 'Change number of days printed', // 6 'Applicatoin stats', // 7 diff --git a/lib/event_ds.dart b/lib/event_ds.dart index 6712ef6..b889868 100644 --- a/lib/event_ds.dart +++ b/lib/event_ds.dart @@ -541,7 +541,7 @@ Set readEventsFromFile(String filename) { events.add(e); } } on Exception catch(e) { - print("cannot open file $gEventsFilename"); + //print("cannot open file $gEventsFilename"); if( gDebug > 0) print("Could not open file. error = $e"); } diff --git a/lib/tree_ds.dart b/lib/tree_ds.dart index 937617b..b2af4f2 100644 --- a/lib/tree_ds.dart +++ b/lib/tree_ds.dart @@ -784,14 +784,14 @@ class Tree { // returns true if the given words exists in it or its children bool hasWords(String word) { - //if(gDebug > 0) print("In tree selector hasWords: this id = ${e.eventData.id} word = $word"); - if( e.eventData.content.length > 1000) { + if( e.eventData.content.length > 2000) { // ignore if content is too large, takes lot of time return false; } + bool childMatches = false; for( int i = 0; i < children.length; i++ ) { // ignore too large comments - if( children[i].e.eventData.content.length > 1000) { + if( children[i].e.eventData.content.length > 2000) { continue; } @@ -800,7 +800,7 @@ class Tree { } } - if( e.eventData.content.toLowerCase().contains(word)) { + if( e.eventData.content.toLowerCase().contains(word) || e.eventData.id == word ) { e.eventData.isNotification = true; return true; }