# Search logic (primary and secondary)

```
Search Behavior -> Keyword Logic and Matching
```

![](/files/gRDRI8gC4DlfXEu8oGVM)

There are **4 possible logics** to choose from:

* OR (default)
* OR with exact word matches
* AND
* AND with exact word matches

The default is "OR". For more information about the logics please read [search logics explained](/behavior/search-logic/search-logics-explained.md)

### Primary vs Secondary keyword logic

Primary is the main logic, that the search uses by default. When there are not enough results to reach the [limit](broken://pages/-L9jkL0axQfFUrEZ1mqf), the plugin automatically tries again with secondary keyword logic to fill the remaining results.

Always choose a more strict logic as the primary, and a less strict as secondary. Logic order by strictness (most strict first):

1. AND with exact keyword matches
2. AND
3. OR with exact keyword matches
4. OR

Recommended configurations:

| Primary keyword logic          | Secondary keyword logic       |
| ------------------------------ | ----------------------------- |
| AND with exact keyword matches | AND                           |
| OR with exact keyword matches  | OR                            |
| AND                            | OR with exact keyword matches |
| AND                            | OR                            |
| AND with exact keyword matches | OR with exact keyword matches |
| AND with exact keyword matches | OR                            |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://documentation.ajaxsearchpro.com/behavior/search-logic.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
