Multiple filter using php client

filter
predicate

#1

hi, I want to apply multiple filters on query to get records. Here is the sample code -

$where[] = Aerospike::predicateEquals($col1, $val1); $where[] = Aerospike::predicateEquals($col2, $val2); $status = $aersopike->query($namespace, $set, $where, function ($record) use (&$result) { $result[] = $record[‘bins’]; });

But it throws an error i.e. Predicate is expected to include the keys ‘bin’,‘op’, and ‘val’.

How can i apply multiple filter on query using php client??..please help

Regards Nitish Janterparia


#2

@nitish_janterparia …Hi, you can not apply multiple filters directly…You need to create UDA functions to filter data from multiple bins. To create UDF

  1. Create lua file and place in any directory
  2. Load that file as module in aerospike
  3. Change the path in php.ini file for aerospike usr-lua path
  4. Rest you can see the syntax over aerospike website

#3

@nitish_janterparia … Thanks for reply :wink: