google / sawbuck

Automatically exported from code.google.com/p/sawbuck
107 stars 40 forks source link

Boolean filtering #58

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Right now, the filtering systems seem to act exclusively on an OR basis. If one 
one wants [if:(File:is:"CONSOLE" AND Message:contains:"ERRROR") then:include], 
they're out of luck. And since there is no NOT operation, that can't be 
simulated with excludes either.

Can we get filtering with support for AND and NOT?

Original issue reported on code.google.com by a...@zfirmllc.com on 31 Aug 2012 at 9:30

GoogleCodeExporter commented 8 years ago
The filtering is what it is for want of someone to work on it. I'd be delighted 
to take a patch to improve it, or alternatively at least a UI proposal :).

Original comment by siggi@chromium.org on 4 Sep 2012 at 12:50

GoogleCodeExporter commented 8 years ago
Unfortunately, I don't know C/C++ well, so I can't really do a patch - 
especially for AND logic (which would require caching possible results and 
running ALL tests on them).

But adding :containsnot and :isnot filtering options would go a long way. I 
imagine you could implement the backend easily:

//filter.cc (pseucodode example)
bool Filter::ValueMatchesInt(int check_value) const {
  bool matches = false;
  if (relation_.startsWith(IS)) {
  //..........
  } else if (relation_.startsWith(CONTAINS)) {
  //.........
  } else {
     return matches; //on failure, don't want to use xor
  }  
  return !(matches ^ relation_.endsWith(NOT));
}

And then leave the UI almost unchanged, just with more popdown conditions:

//filter_dialog.cc (example)
const wchar_t* FilterDialog::kRelations[] = {
  L"is",
  L"isnot",
  L"contains",
  L"containsnot",
};

Original comment by a...@zfirmllc.com on 4 Sep 2012 at 4:34