@@ 1167-1182 (lines=16) @@ | ||
1164 | * @param array $values |
|
1165 | * @param bool $exclude |
|
1166 | */ |
|
1167 | public function setFilter($attribute, array $values, $exclude = false) |
|
1168 | { |
|
1169 | assert(is_string($attribute)); |
|
1170 | assert(count($values)); |
|
1171 | ||
1172 | foreach ($values as $value) { |
|
1173 | assert(is_numeric($value)); |
|
1174 | } |
|
1175 | ||
1176 | $this->filters[] = array( |
|
1177 | 'type' => SPH_FILTER_VALUES, |
|
1178 | 'attr' => $attribute, |
|
1179 | 'exclude' => $exclude, |
|
1180 | 'values' => $values |
|
1181 | ); |
|
1182 | } |
|
1183 | ||
1184 | /** |
|
1185 | * Set string filter |
|
@@ 1213-1227 (lines=15) @@ | ||
1210 | * @param int $max |
|
1211 | * @param bool $exclude |
|
1212 | */ |
|
1213 | public function setFilterRange($attribute, $min, $max, $exclude = false) |
|
1214 | { |
|
1215 | assert(is_string($attribute)); |
|
1216 | assert(is_numeric($min)); |
|
1217 | assert(is_numeric($max)); |
|
1218 | assert($min <= $max); |
|
1219 | ||
1220 | $this->filters[] = array( |
|
1221 | 'type' => SPH_FILTER_RANGE, |
|
1222 | 'attr' => $attribute, |
|
1223 | 'exclude' => $exclude, |
|
1224 | 'min' => $min, |
|
1225 | 'max' => $max |
|
1226 | ); |
|
1227 | } |
|
1228 | ||
1229 | /** |
|
1230 | * Set float range filter |
|
@@ 1238-1252 (lines=15) @@ | ||
1235 | * @param int $max |
|
1236 | * @param bool $exclude |
|
1237 | */ |
|
1238 | public function setFilterFloatRange($attribute, $min, $max, $exclude = false) |
|
1239 | { |
|
1240 | assert(is_string($attribute)); |
|
1241 | assert(is_float($min)); |
|
1242 | assert(is_float($max)); |
|
1243 | assert($min <= $max); |
|
1244 | ||
1245 | $this->filters[] = array( |
|
1246 | 'type' => SPH_FILTER_FLOATRANGE, |
|
1247 | 'attr' => $attribute, |
|
1248 | 'exclude' => $exclude, |
|
1249 | 'min' => $min, |
|
1250 | 'max' => $max |
|
1251 | ); |
|
1252 | } |
|
1253 | ||
1254 | /** |
|
1255 | * Setup anchor point for geosphere distance calculations |