added search by event id, along with search by word

This commit is contained in:
Vishal
2022-08-30 20:22:21 +05:30
parent 4d2f905c3f
commit 9eb58020d7
3 changed files with 6 additions and 6 deletions

View File

@@ -161,7 +161,7 @@ Future<void> otherMenuUi(Tree node, var contactList) async {
int option = showMenu([ 'Show user profile', // 1 int option = showMenu([ 'Show user profile', // 1
'Display contact list', // 2 'Display contact list', // 2
'Follow new contact', // 3 'Follow new contact', // 3
'Search word(s)', // 4 'Search word(s) or event id', // 4
'Search by client name', // 5 'Search by client name', // 5
'Change number of days printed', // 6 'Change number of days printed', // 6
'Applicatoin stats', // 7 'Applicatoin stats', // 7

View File

@@ -541,7 +541,7 @@ Set<Event> readEventsFromFile(String filename) {
events.add(e); events.add(e);
} }
} on Exception catch(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"); if( gDebug > 0) print("Could not open file. error = $e");
} }

View File

@@ -784,14 +784,14 @@ class Tree {
// returns true if the given words exists in it or its children // returns true if the given words exists in it or its children
bool hasWords(String word) { bool hasWords(String word) {
//if(gDebug > 0) print("In tree selector hasWords: this id = ${e.eventData.id} word = $word"); if( e.eventData.content.length > 2000) { // ignore if content is too large, takes lot of time
if( e.eventData.content.length > 1000) {
return false; return false;
} }
bool childMatches = false; bool childMatches = false;
for( int i = 0; i < children.length; i++ ) { for( int i = 0; i < children.length; i++ ) {
// ignore too large comments // ignore too large comments
if( children[i].e.eventData.content.length > 1000) { if( children[i].e.eventData.content.length > 2000) {
continue; 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; e.eventData.isNotification = true;
return true; return true;
} }