# Query Builder

> Build complex searches using rules, groups, operators, and logic inside Kommon Polls Query Builder.

> Build complex searches using rules, groups, operators, and logic inside Kommon Polls Query Builder.

The **Query Builder** lets you craft precise, Boolean-style searches by mixing rules, groups, and operators until the results match your listening goal.

## 1. Start Building Your Query

After adding your social tracking sources, open **Query Builder** inside Kommon Poll.

You can add new rule lines or group blocks and pair them with logical operators:

- **AND** – requires every condition inside the group to match.
- **OR** – allows any condition in the group to match, which broadens the results.

These operators control how your rules work together and help you narrow or expand the data Kommon Poll returns.

## 2. Adding Rules

### Add Rule

Click **Add Rule** to add another condition to the query.

Each rule includes:

- An `Enter criterion` field for keywords or phrases.
- A condition dropdown (contains phrase, contains, does not contain, etc.).
- A source or entity operator that limits where or how the rule is matched.

Rules are the building blocks of your query logic design.

## 3. Adding Groups

### Add Group

Click **Add Group** to combine multiple rules under the same logical operator (AND/OR).

Groups help you:

- Organize related conditions.
- Assemble complex queries that mix nested logic.
- Apply different operators inside larger expressions (e.g., multiple OR rules inside a parent AND block).

## 4. Source Operators

Source operators determine **where** Kommon Poll looks for keywords or phrases.

### 4.1 Entire Mention

Searches the full mention, including:

- Title.
- Body text.
- Metadata (tags, classifications, system properties).

Use this when you want the entire document to be evaluated.

### 4.2 Entire Mention (Excluding Metadata)

Targets everything except metadata, keeping the search focused on user-generated content.

Exclude tags, classifications, and other system fields while retaining title and body text.

### 4.3 Title

Searches only the document title.

Use this when the keyword must appear in the title rather than the body.

### 4.4 Text Context

Searches only the body copy (excludes title and metadata).

Ideal when you want picks that are tied to the main written content.

## 5. Entity Operators

Entity operators control **how** your phrase matches the text.

### 5.1 Contains Phrase

Matches an exact phrase in the mention.

### 5.2 Contains

Matches the given keywords in any order.

### 5.3 Does NOT Contain Phrase

Filters out mentions containing that exact phrase.

### 5.4 Does NOT Contain

Filters out mentions containing any of the specified keywords.

## 6. Common Logical Operators

### AND

- Narrows the search.
- All conditions must be true.
- Use when you need high precision.

### OR

- Broadens the search.
- Any condition may be true.
- Use when capturing variations or alternatives matters.

## 7. Deleting Rules or Groups

If you need to remove a rule or group, click the **Delete** button beside it.

Kommon Poll updates the logic tree automatically so the remaining structure stays valid.

## 8. Apply Your Query

Once all rules and groups look correct:

1. Review the logic structure and operators.
2. Confirm that source and entity operators match your intent.
3. Click **Apply** to run the query.

Kommon Poll executes the search according to the conditions and hierarchy you built.
