Hello everyone,

Problem/Motivation

Currently, the views_json_source module only supports basic comparison operators such as "Is equal to", "Is not equal to", and string-based operators like "Contains" or "Starts with". There is no support for numeric range comparisons like "Is greater than or equal to" (>=) or "Is less than or equal to" (<=). This makes it impossible to filter JSON data by numeric ranges, such as filtering the entities by a specific year range.

Steps to reproduce

1. Create a View using a JSON source.
2. Add a filter for a numeric field (e.g., "Year").
3. Observe that the "Operator" dropdown does not include "Is greater than or equal to" or "Is less than or equal to".
4. Attempting to manually add these operators to the View configuration results in no filtering being applied because the query plugin doesn't recognize them.

Proposed resolution

1. Update ViewsJsonFilter.php to include '>=' and '<=' in the operators() method.
2. Update the ops() method in ViewsJsonQuery.php to handle the new '>=' and '<=' operators by performing the corresponding PHP comparisons.

Thanks in advance,
Orkut

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

orkut murat yılmaz created an issue. See original summary.

orkutmuratyilmaz’s picture

Status: Active » Needs review

Can you please review the MR?