> ## Knowledge Base Index
> Fetch the complete knowledge base index at: https://help.repliers.com/sitemap.xml
> Use this file to discover available pages before exploring further.
> Pure-Markdown content can be obtained by appending a '.md' suffix to the content URLs listed in the sitemap (without the trailing slash).

# Understanding Operators In The Repliers API


## Overview

When querying the Repliers API with multiple values for the same parameter, it's important to understand how these values are combined logically. This guide explains how the `operator` parameter affects your search results, and when you should use it.

## Default Behavior: AND Between Parameters, OR Within Parameters

By default, our API uses the following logic:

* Values for the **same parameter** are combined with **OR** logic
* **Different parameters** are combined with **AND** logic

### Example: Default Behavior (operator=AND, which is the default)

```
https://api.repliers.io/listings?mlsNumber=1&mlsNumber=2&mlsNumber=3&propertyType=a&propertyType=b&propertyType=c&style=x&style=y&style=z
```

This query returns listings that match:

```
(mlsNumber = 1 OR mlsNumber = 2 OR mlsNumber = 3)
AND
(propertyType = a OR propertyType = b OR propertyType = c)
AND
(style = x OR style = y OR style = z)
```

## Alternative Behavior: Using operator=OR

When you set `operator=OR`, the logic between different parameters changes:

* Values for the **same parameter** are still combined with **OR** logic (unchanged)
* **Different parameters** are now combined with **OR** logic (instead of AND)

### Example: OR Between Parameters (operator=OR)

```
https://api.repliers.io/listings?mlsNumber=1&mlsNumber=2&mlsNumber=3&propertyType=a&propertyType=b&propertyType=c&style=x&style=y&style=z&operator=OR
```

This query returns listings that match:

```
(mlsNumber = 1 OR mlsNumber = 2 OR mlsNumber = 3)
OR
(propertyType = a OR propertyType = b OR propertyType = c)
OR
(style = x OR style = y OR style = z)
```

## Common Misconception

Some users believe they need to add `operator=OR` to find listings matching any value within a single parameter. This is incorrect.

### Example: Unnecessary Use of operator=OR

```
https://api.repliers.io/listings?mlsNumber=1&mlsNumber=2&mlsNumber=3&operator=OR
```

The user's intention is to find listings with mlsNumber 1, 2, or 3. However, this query is equivalent to:

```
https://api.repliers.io/listings?mlsNumber=1&mlsNumber=2&mlsNumber=3
```

Both queries will return listings with mlsNumber 1, 2, or 3 because values for the same parameter are always combined with OR logic, regardless of the operator parameter.

## When to Use operator=OR

Use `operator=OR` when you want to find listings that match ANY of your specified parameters, rather than ALL of them.

### Good Use Case for operator=OR

If you want to find listings that are either:

* In a specific location, OR
* Of a specific property type, OR
* Within a certain price range

Then `operator=OR` is appropriate:

```
https://api.repliers.io/listings?location=downtown&propertyType=condo&priceRange=500000-700000&operator=OR
```

This returns listings that match ANY of these criteria, rather than requiring ALL criteria to be met.

## Best Practices

1. **Default Behavior (AND)**: Use when you want to narrow your search with multiple criteria.
2. **OR Operator**: Use when you want to broaden your search to include results matching any of your criteria.
3. **Same Parameter Values**: Remember that multiple values for the same parameter are always combined with OR logic.
4. **Different Parameters**: These are combined with AND logic by default, or OR logic when `operator=OR` is specified.

## Summary

* The `operator` parameter controls logic between different parameters, not within the same parameter
* Default ( `operator=AND`): Different parameters use AND logic, same parameters use OR logic
* Alternative ( `operator=OR`): Different parameters use OR logic, same parameters still use OR logic
* Only use `operator=OR` when you want to find listings that match ANY of your different parameter criteria, rather than ALL of them

# What questions does this article answer?

* How does the logical `operator` parameter affect how filters are combined?  
* What is the default behavior (AND between different parameters, OR within repeated values)?  
* When should I set `operator=OR`, and what does it change in the query logic?  
* Do I need `operator=OR` to make multiple values on a single parameter work?  
* How do I reason about the resulting boolean logic of a complex query?
