not_group support
hey,
is something like a ’not_group’ available within searchlogic (or in combination with ActiveRecord)?
e.g.: s=System.new_search => #<SystemSearch {:limit=>25}>
g=s.conditions.not_group => #<SystemConditions> g.name_equals="test" => "test" g.descr_equals="test" => "test" s.count => 95
generated sql: SQL (0.5ms) SELECT count("systems".id) AS count_id FROM "systems" WHERE (NOT (("systems"."name" = ’test’ AND "systems"."descr" = ’test’)))
This ticket has 0 attachment(s).
not_group support
After digging around, trying to find another solution without success I decided to implement that feature within searchlogic. The changes are committed to a fork of searchlogic (http://github.com/sdecastelberg/searchlogic/tree/master). Maybe someone can have a look at it. Feedback is appreciated. (i’m rather new to ruby/ror..)
The implemented not_group works fine for my needs.
by sdecastelberg
not_group support
Why wouldn’t you adjust your conditions to have the opposite effect instead of doing a not_group. Either way, whatever works for you, if you like the not_group solution then I think its fine, but couldn’t you accomplish the same thing by adjusting your conditions?
by Ben Johnson
not_group support
the not_group was initially needed for a monitoring/inventory application to map network components (software and hardware) and provide configuration for different network and application layer scanners.
For bulk editing, reporting, etc. we needed an exact match search for every single attribute on every model.
Search Dialog
*group1 *SnmpScan (include) *oid=ssCpuIdle *alarm-threshold=90 *System (exclude) *Status=Test *Modified Date start: 2009-01-01
would match the following search (when searching for systems)
(system.snmp_scan.oid=ssCpuIdle AND system.snmp_scan.alarm_threshold=90) AND NOT (system.state=Test AND modified_date>=2009-01-01)
The attributes are grouped model-wise and can be combined differently (and, or) and the search can be expanded by adding other groups with subgroups. The include/exclude flag just sets the not_group attribute on the group, without having to negate all the single attributes.
by sdecastelberg
not_group support
I see what you’re saying. But searchlogic deals with single conditions. If you are writing your own named scope for these conditions why not add in the "NOT" yourself? I guess I’m a little confused how you are using searchlogic and how you want to use it.
by Ben Johnson