View | Details | Raw Unified | Return to bug 37018
Collapse All | Expand All

(-)a/Koha/REST/Plugin/Query.pm (-1 / +2 lines)
Lines 664-670 sub _rewrite_related_metadata_query { Link Here
664
sub _validate_operator {
664
sub _validate_operator {
665
    my ($operator) = @_;
665
    my ($operator) = @_;
666
    my %allowed_operators =
666
    my %allowed_operators =
667
        map { $_ => 1 } qw(= != < > <= >= like -not_like -in -ident -bool -not_bool -or -like -not -and -regexp);
667
        map { $_ => 1 }
668
        qw(= != < > <= >= -in -ident -bool -not_bool -or like -like -not_like -between -not_between -not -and -regexp);
668
    Koha::Exceptions::REST::Query::InvalidOperator->throw( operator => $operator )
669
    Koha::Exceptions::REST::Query::InvalidOperator->throw( operator => $operator )
669
        unless exists $allowed_operators{$operator};
670
        unless exists $allowed_operators{$operator};
670
    return;
671
    return;
(-)a/api/v1/swagger/swagger.yaml (-2 / +15 lines)
Lines 1018-1030 info: Link Here
1018
    We can refine that with more complex matching clauses by nesting a the clause into the
1018
    We can refine that with more complex matching clauses by nesting a the clause into the
1019
    object; `{ "fieldname": { "clause": "value" } }`.
1019
    object; `{ "fieldname": { "clause": "value" } }`.
1020
1020
1021
    Available matching clauses include `>`, `<`, `>=`, `<=`, `-like`, and `-not_like`.
1021
    Available matching clauses include `=`, `!=`, `<`, `>`, `<=`, `>=` and `-not`. We also support `-like`
1022
    and `-not_like` string comparisons with `%` used to denote wildcards, thus you can pass
1023
    `{ "fieldname": { "-like": "value%" } }` to do a 'starts with' string match for example.
1022
1024
1023
    We can filter on multiple fields by adding them to the JSON respresentation. Adding at `HASH`
1025
    We can filter on multiple fields by adding them to the JSON respresentation. Adding at `HASH`
1024
    level will result in an "AND" query, whilst combinding them in an `ARRAY` will result in an
1026
    level will result in an "AND" query, whilst combinding them in an `ARRAY` will result in an
1025
    "OR" query: `{ "field1": "value2", "field2": "value2" }` will filter the response to only those
1027
    "OR" query: `{ "field1": "value2", "field2": "value2" }` will filter the response to only those
1026
    results with both field1 containing value2 AND field2 containing value2 for example.
1028
    results with both field1 containing value2 AND field2 containing value2 for example.
1027
1029
1030
    There is a collection of special operators also available to you, including:
1031
1032
    * `-in` - Expects an array of values to perform an OR match against
1033
    * `-not_in` - Expects an array of values to perform a NOR match against
1034
    * `-between` - Expects two values which the value of the field is expected to fall between
1035
    * `-not_between` - Expects two values which the value of the field is expected to fall outside of
1036
    * `-ident` - Expects a second field name to match the two field values against
1037
    * `-regexp` - Expects a perl compatible regular expression for which the value should match
1038
1039
    Logic and nesting is also supported and you may use `-and` and `-or` to change the logic of an ARRAY
1040
    or HASH as described above.
1041
1028
    Additionally, if you are requesting related data be embedded into the response one can query
1042
    Additionally, if you are requesting related data be embedded into the response one can query
1029
    on the related data using dot notation in the field names.
1043
    on the related data using dot notation in the field names.
1030
1044
1031
- 

Return to bug 37018