User Tools

Site Tools


dev:search:filters

This is an old revision of the document!


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.
dev/search/filters.1614563129.txt.gz · Last modified: 2022/02/10 13:34 (external edit)

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki

© 2008-2022 GPLS and others. Evergreen is open source software, freely licensed under GNU GPLv2 or later.
The Evergreen Project is a U.S. 501(c)3 non-profit organization.