Advanced Query Building
Use advanced search syntax for field targeting, phrases, fuzzy matching, wildcards, proximity, boosting, and expert exclusions.
Use advanced query syntax for precise searches with field targeting, fuzzy matching, proximity, boosting, and expert exclusions.
Advanced Query Building is for users who need more control than the visual Query Builder provides. Kommon Poll's search backend can accept advanced query-string syntax in the main query where that advanced input is exposed.
Use this page when you need to:
- Search specific fields such as title, body text, hashtags, authors, or visual intelligence fields.
- Handle spelling variations and typos.
- Search terms near each other.
- Boost high-value terms or fields.
- Exclude noisy results precisely.
Important: Advanced query syntax is strict. Invalid punctuation, unmatched quotes, or malformed field queries can cause the search to fail. If you are not sure, use the visual Query Builder and filters first.
1. Wildcards
Wildcards match unknown characters inside a single term. They are useful when users spell the middle of a word differently, when a word has regional spelling variants, or when one character may vary.
Leading and trailing wildcards are not allowed in Kommon Poll advanced queries.
Do not use:
*bankpay*?cardbank?
Use wildcards only inside the term when needed.
| Syntax | Meaning | Example |
|---|---|---|
* |
Zero or more characters inside a term. | colo*r can match color and colour |
? |
Exactly one character inside a term. | wom?n can match woman and women |
Examples:
colo*r AND packaging
This can match color packaging and colour packaging.
wom?n AND health
This can match woman health and women health.
organi?ation AND policy
This can match spelling variants such as organization and organisation when the differing part is one character.
Use wildcards sparingly. If a wildcard query feels broad, use explicit alternatives instead:
(color OR colour) AND packaging
Explicit alternatives are often easier to read, safer to maintain, and less likely to bring in noise.
2. Fuzzy Matching
Fuzzy matching finds terms that are close to the word you typed. It is useful for typos, transliteration differences, OCR errors, and casual social spelling.
The number after ~ controls how many small edits are allowed. An edit can be an inserted, deleted, replaced, or swapped character.
| Syntax | Meaning | Example |
|---|---|---|
term~ |
Fuzzy match with default edit distance. | kommon~ |
term~1 |
Fuzzy match with edit distance 1. | komon~1 |
term~2 |
Fuzzy match with edit distance 2. | komon~2 |
Examples:
(kommonpoll OR "kommon poll" OR komonpoll~1)
This can catch the correct spelling plus a close typo such as komonpoll.
delivery~1 AND complaint
This can catch minor misspellings of delivery in complaint mentions.
airline~1 AND refund
This can catch simple spelling mistakes around airline while still requiring refund.
Use lower fuzziness first:
~1is better for controlled typo handling.~2is broader and can introduce unrelated matches on short words.
Avoid fuzzy matching on very short words such as app~2, because short terms can expand too broadly.
Do not combine fuzzy and wildcard operators in the same term. For example, avoid kom*on~1.
3. Proximity Matching
Proximity matching finds words near each other, even if they are not directly adjacent or in the exact phrase form. It is useful when users describe the same issue with extra words in between.
The number after ~ is the allowed distance between phrase terms. Smaller numbers are stricter. Larger numbers are broader.
| Syntax | Meaning | Example |
|---|---|---|
"a b"~n |
Match phrase terms within n positions. |
"credit card declined"~5 |
field:"a b"~n |
Apply proximity inside a field. | original.S:"app not working"~4 |
Examples:
"credit card declined"~5 AND bank
This can match mentions where credit, card, and declined appear close together.
"delivery package damaged"~6
This can match text such as the package was delivered but arrived damaged.
original.S:"app not working"~4
This searches the main text field for mentions where app, not, and working appear close together.
"flight delayed refund"~8 AND airline
This can catch posts where users discuss a delayed flight and refund in the same short context.
Use proximity when exact phrase matching is too strict but normal AND matching is too broad.
- Exact phrase:
"credit card declined"only matches that phrase order. - Normal AND:
credit AND card AND declinedcan match words far apart in the same mention. - Proximity:
"credit card declined"~5keeps the words close enough to be related.
4. Field-Specific Search
Field-specific search is useful when you know where a signal should appear.
Main Text Fields
| Need | Field | Example |
|---|---|---|
| Main post, article, or body text | original.S |
original.S:"mobile app not working" |
| Title or headline | title.S |
title.S:(fraud OR scam) |
| OCR or media text | media_text.S |
media_text.S:"limited offer" |
| Image description | media_imageDescription.S |
media_imageDescription.S:"queue at branch" |
| Parent post text | parentText.S |
parentText.S:"bank charges" |
| Comment, reply, or action label | action.S |
action.S:(comment OR reply) |
Author, Mention, And Hashtag Fields
| Need | Field | Example |
|---|---|---|
| Author handle or page | authors.S |
authors.S:"John Doe" |
| Author display name | authorsName.S |
authorsName.S:"Daily Mirror" |
| Parent author | parentAuthor.S |
parentAuthor.S:"Dialog" |
| Mentioned accounts or entities | mentions.* |
mentions.*:(kommonpoll OR Synapse) |
| Hashtags | hashtags.* |
hashtags.*:(lankaqr OR govpay) |
Visual Intelligence Fields
| Need | Field | Example |
|---|---|---|
| Detected object | media_object.* |
media_object.*:(car OR phone) |
| Detected logo | media_logo.* |
media_logo.*:"Commercial Bank" |
| Image description | media_imageDescription.S |
media_imageDescription.S:"damaged package" |
5. Use Filters For Structured Attributes
Use Kommon Poll filters instead of query text for structured attributes whenever possible.
Prefer filters for:
- Platform.
- Country.
- Language.
- Nationality.
- Age group.
- Gender.
- Education.
- Income.
- Business account status.
- Tags.
- Subtopics.
- Intents.
- Sentiment.
- Subjectivity.
- Influence.
- Engagement.
- Date range.
Why: filters narrow the result set without changing text relevance. Some values, especially sentiment and influence, use additional backend logic and are more reliable through filters than through manual query text.
If support or an advanced workflow requires fielded examples, these are common structured fields:
| Need | Prefer UI filter | Fielded example |
|---|---|---|
| Platform | Platform/source filter | itemType.S:twitter |
| Country | Country filter | published_country.S:LK |
| Language | Language filter | language.S:si |
| Nationality | Nationality filter | nationality.S:"Sri Lankan" |
| Age group | Age filter | age.S:"25-34" |
| Gender | Gender filter | gender.S:female |
| Education | Education filter | education.S:graduate |
| Income | Income filter | income.S:high |
| Business account | Business account filter | isbusiness.N:1 |
These fielded examples are less user-friendly than filters and may depend on exact stored values.
6. Entity And Analysis Fields
Some extracted entities can be queried directly when you need targeted matching.
| Need | Field | Example |
|---|---|---|
| Key phrase | key_phrases.* |
key_phrases.*:"customer service" |
| Company | companies.* |
companies.*:"Dialog" |
| Person | persons.* |
persons.*:"CEO name" |
| Product | products.* |
products.*:"credit card" |
| Event | events.* |
events.*:"launch" |
| Location | geolocations.* |
geolocations.*:"Colombo" |
Use entity fields carefully because extracted entity values may vary by language, source, and data enrichment quality.
7. Boosting
Boosting changes relevance scoring. It does not filter results by itself.
Boosting can also influence the Kommon Poll influence score when search relevance contributes to the calculated influence value.
| Syntax | Meaning | Example |
|---|---|---|
term^2 |
Boost a word. | Dialog^2 outage |
"phrase"^3 |
Boost a phrase. | "customer service"^3 complaint |
(a OR b)^2 |
Boost a group. | (scam OR fraud)^2 bank |
field:value^2 |
Boost a fielded match. | title.S:fraud^3 original.S:fraud |
Use boosting when one signal is more important but should not be mandatory.
Example:
title.S:("interest rates" OR "policy rate")^3 OR original.S:("interest rates" OR "policy rate")
This favors title/headline matches while still allowing body-text matches.
8. Escaping Reserved Characters
The following characters have special meaning in advanced query syntax:
+ - = && || > < ! ( ) { } [ ] ^ " ~ * ? : \ /
If you need to search for one literally, escape it with a backslash.
Example:
2\*3
Notes:
- Unmatched quotes can break a search.
- A colon
:is interpreted as field syntax unless escaped. - Backslashes themselves may need extra escaping in API or JSON contexts.
<and>are treated as range operators and should be avoided in literal search text.
9. Practical Examples
Global Airline Monitoring
("SkyJet Airways" OR "SkyJet Air" OR @SkyJet) AND (flight OR booking OR baggage OR refund OR delay)
Retail Customer Complaints
("Northstar Retail" OR Northstar) AND (bad OR issue OR problem OR delay OR "not delivered" OR complaint)
Exclude Irrelevant Apple Mentions
(Apple OR iPhone OR MacBook) AND (battery OR update OR store) NOT fruit NOT "apple pie" NOT orchard
Fuzzy Typo Handling
("Kommon Poll" OR KommonPoll OR komonpoll~1)
Scam And Misinformation Detection
(title.S:(scam OR fraud OR fake) OR original.S:(scam OR fraud OR fake OR impersonation)) AND ("Global Trust Bank" OR GTB)
Visual Logo Or Object Mentions
(media_logo.*:"Starbucks" OR media_object.*:(cup OR coffee OR storefront))
Hashtag Or Mention Search
(hashtags.*:WorldCup OR mentions.*:FIFA)
News Or Title-Heavy Query
title.S:("interest rates" OR "policy rate")^3 OR original.S:("interest rates" OR "policy rate")
10. Advanced Query Checklist
Before saving an advanced query:
- Wrap multi-word phrases in quotes.
- Use parentheses when mixing
AND,OR, andNOT. - Do not use leading wildcards such as
*bank. - Do not use trailing wildcards such as
pay*. - Do not combine fuzzy and wildcard operators in the same term.
- Use filters for structured attributes and analytics values.
- Test with a short time range first.
- Save a clean version of the query before making experimental changes.