Added direction notes

This commit is contained in:
2022-09-17 06:42:49 +08:00
parent 7fd8d4fb6a
commit b251e35be4
5 changed files with 44 additions and 4 deletions

View File

@@ -58,14 +58,21 @@ func Parse( line string, entries *[] ISearchable ) ( *QueryObject, error ) {
return &QueryObject{ Key: Key, Results: &matches, SearchTerms: &terms }, nil
} else if 0 < len( terms ) {
for _, entry := range *entries {
anyFailed := false
for _, term := range terms {
if term.IsKey {
continue
}
if ( Key == "" || Key == *entry.GetKey() ) && entry.Test( term.Value ) {
matches = append( matches, entry )
if !( ( Key == "" || Key == *entry.GetKey() ) && entry.Test( term.Value ) ) {
anyFailed = true
break
}
}
if !anyFailed {
matches = append( matches, entry )
}
}
return &QueryObject{ Key: Key, Results: &matches, SearchTerms: &terms }, nil
}