Adding a search filter

Adding a search filter is pretty straightforward, and you only need to touch one file: Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Driver/Pg/QueryParser.pm

To add a filter:

  1. Register your filter with
    __PACKAGE__->add_search_filter();
  2. Add some logic for your filter – this will be concatenated into a humongous SQL query.
    • If you just need to add to the WHERE clause, add it to the flatten subroutine.
    • If you need to add a JOIN (by either bib record ID or metabib ID), add it to the toSQL subroutine.
    • Each filter needs to have one or more comma-separated arguments. You can see which arguments the user passed in with
      @{$filter->args}
    • Probably, your filter should function differently if it is negated (i.e. the user searches for `-my_filter(1)` instead of `my_filter(1)`). $filter->negate will be 1 if it is negated.