All articles
Sourcing & outreach

How to Write Boolean Search Strings with Claude or Gemini (and Why They Break)

To write Boolean strings with Claude or Gemini, give it the job and your platform's rules, then check every NOT, every AND group and the operator limit.

  • Saves time
  • Better hires

Oct 7, 2026 · 17 min read

Gemini wrote "35" under its broad LinkedIn string. We counted 42 Boolean operators. Sales Navigator stops at 15.

That was one of seven ways the strings in our test went wrong. None was a typo: every parenthesis balanced. Each one quietly drops people the job wants.

The short answer: paste the job description into Claude or Gemini, say which platform you'll search and what it supports, and ask for a broad and a narrow string with the operators counted. Then send the audit prompt below: it caught the bad NOTs and the nice-to-have gates, but not the counts or the limits. Read every NOT yourself, because a job's "not needed" is not "not wanted", and count operators against your platform's limit. Gemini miscounted; Claude counted right with a script, but wrote strings too long for Sales Navigator.

Find your symptom

What you see Likely cause Fix
No German speakers in a Berlin search A NOT on a language 1
Very few results for a common role Nice-to-haves joined with AND, or a "broad" string with too many gates 2, 3
Engineers who built hiring tools are missing A -recruiter exclusion 4
A string too long for Sales Navigator Too many operators, miscounted 5
Google seems to ignore your last terms More than 32 words 6
A job board string full of NEAR/5 and * Operators the board may not support 7

The role behind every string below

The role: Senior Backend Engineer, payments team, at Pelican Pay, a made-up 120-person Berlin fintech. We asked for strings for LinkedIn, a Google X-ray and a job board CV database, from this job description:

Senior Backend Engineer, Payments - Pelican Pay (a fictional 120-person fintech that runs card payments and payouts for online marketplaces)
Location: Berlin, hybrid (2 days a week in the office). Relocation within the EU is supported.
What you will do: build and run the services that move money - payment authorization, the internal ledger, payouts to sellers, and reconciliation with banks and card networks.
Must-haves:
1. 5+ years building backend services in production
2. Strong Go, or strong Java or Kotlin and willing to move to Go
3. Hands-on experience with payment systems, ledgers, billing or other money-movement systems
4. PostgreSQL and event streaming (Kafka or similar)
Nice to have: PCI DSS, idempotency and distributed transactions, Kubernetes, experience at a payment service provider, bank or neobank.
We don't need: a degree, German language, frontend.

Gemini 2.5 Flash got the prompt twice (plus three follow-ups). Claude Opus 5.5 answered once, plus the audit, starting cold with no view of our traps. A small script counted every parenthesis and operator. The platform rules in the prompt come from LinkedIn Help and from GoogleGuide, which puts Google's limit at 32 words, terms and operators together.

1. The job said "not needed". The string heard "not wanted".

Maya holding up a long paper chain with one link torn open in the middle

This is Gemini's broad LinkedIn string from its second run. Read the last group.

(Go OR Golang OR Java OR Kotlin) AND (Payments OR Payables OR "Payment Processing" OR Fintech OR "Financial Services" OR "Payment gateway" OR Billing OR Ledger OR Invoicing OR Payouts OR "Money movement" OR "Funds transfer" OR "Payment authorization" OR "Bank integration" OR "Card networks") AND (PostgreSQL OR Postgres) AND (Kafka OR "event streaming" OR "message queue" OR "messaging queue" OR RabbitMQ OR Pulsar) AND ("Backend Engineer" OR "Software Engineer" OR "Platform Engineer" OR "Go Engineer" OR "Golang Engineer" OR "Payments Engineer" OR "Fintech Engineer" OR "Staff Engineer" OR "Principal Engineer" OR "Lead Engineer") NOT (frontend OR "front-end" OR German OR Deutsch OR UI OR UX)

The job says German isn't needed. NOT (... German OR Deutsch ...) removes everyone who lists German on their profile, for a job in Berlin, plus anyone who mentions UI or UX. Language often stands in for where someone is from, so hunt for this slip first. It leaves no trace: the people just aren't there.

It carried into both later follow-ups, which we sent on the answer before the audit: Gemini's Sales Navigator rewrite still ended in NOT (frontend OR German), and so did its string with German job titles.

The fix: delete the NOT group, or keep only what the job truly rules out. For every NOT, finish the sentence "this removes anyone who..." out loud. Claude did this unprompted, leaving frontend out because "full-stack people with strong backend skills would be lost". Its audit: "'Frontend', 'German' and 'degree' are things the job description says it doesn't need, not things it rejects." For Gemini, the prompt's rules didn't stop the German exclusion; the audit near the end did.

2. Four nice-to-haves, promoted to must-haves

Gemini's narrow LinkedIn string, second run:

(Go OR Golang) AND ("Payment Systems" OR "Payment Processing" OR "Payment authorization" OR Ledger OR Payouts OR "internal ledger") AND (PostgreSQL OR Postgres) AND (Kafka OR "event streaming") AND ("Backend Engineer" OR "Software Engineer" OR "Go Engineer" OR "Payments Engineer") AND (idempotency OR Kubernetes OR "PCI DSS" OR "distributed transactions") NOT (frontend OR "front-end" OR German OR Deutsch)

That last AND group turns four nice-to-haves into a requirement. Both Gemini runs did it. So did Claude's job board narrow string, ending AND (PCI OR idempotency OR "distributed transactions" OR Kubernetes OR PSP OR neobank OR fintech OR bank). Claude said so under it, and its audit removed the group: "Breaks the rule."

The fix: cut the group. After the audit, Gemini's narrow string kept only the must-haves:

(Go OR Golang) AND ("Payment Systems" OR "Payment Processing" OR "Payment authorization" OR Ledger OR Payouts OR "internal ledger") AND (PostgreSQL OR Postgres) AND (Kafka OR "event streaming") AND ("Backend Engineer" OR "Software Engineer" OR "Go Engineer" OR "Payments Engineer")

3. A "broad" string with five gates

Go back to the string in failure 1. A profile needs a language AND a payments word AND PostgreSQL AND Kafka AND a listed title. Few people list their whole stack, so this "broad" search starts narrow.

The fix: keep the broad string to the must-haves people actually write. Claude's, after its audit, had three groups, title, language and domain, and left location to LinkedIn's filter:

("backend engineer" OR "backend developer" OR "back end engineer" OR "software engineer" OR "software developer" OR "Golang developer" OR "Go developer" OR "Java developer" OR "Kotlin developer" OR "payments engineer") AND (Golang OR Java OR Kotlin) AND (payments OR payment OR ledger OR billing OR payouts OR reconciliation OR "money movement" OR settlement)

Run that first and read the first 20 profiles before you reach for the narrow one. It has 20 operators, fine for Recruiter, too many for Sales Navigator (see 5).

4. -recruiter also removes the engineer who built a hiring tool

Claude's broad Google X-ray:

site:linkedin.com/in ("backend engineer" OR "backend developer" OR "software engineer") (Golang OR Java OR Kotlin) (payments OR ledger OR billing OR payouts OR reconciliation) -recruiter -"talent acquisition"

The reason: "Recruiters' profiles are full of these keywords." But a minus sign doesn't know who wrote the word. Out go engineers who built recruiting products, and the tech lead who "worked with talent acquisition to hire the team".

The fix: drop the exclusion. In Claude's words: "Recruiter profiles that slip through are quick to drop in human review." A few wrong profiles cost you seconds of scrolling. A missing engineer is a candidate you never see.

5. Wrong counts, and right counts over the limit

Sales Navigator allows at most 15 Boolean operators in one search, while Recruiter and Recruiter Lite have no limit (LinkedIn Help). Gemini miscounted again and again:

  • Gemini's broad string from failure 1: it said 35 operators and 10 pairs of parentheses. The real count is 42 operators and 6 pairs.
  • Gemini's first-run narrow LinkedIn string: it said 28, the real count is 31.
  • Even after the audit, Gemini wrote 15 operators under a Google string that has 11.

Claude got all six right, in a session where it could run code ("a small script", its audit said). In an earlier run with no tools, it was off by one on 3 of 6. Its problem was the limit: both LinkedIn strings carry 22 operators, and it wrote that "LinkedIn does not publish a length limit for keyword searches." Neither string would run in Sales Navigator.

Boolean operators in the LinkedIn strings: the tool's count vs ours
Tool's countScript countGemini broad, run 2Gemini broad, run 2: Tool's count 35, Script count 4235 → 42Gemini narrow, run 1Gemini narrow, run 1: Tool's count 28, Script count 3128 → 31Gemini narrow, run 2Gemini narrow, run 2: Tool's count 21, Script count 2321 → 23Claude broadClaude broad: Tool's count 22, Script count 2222 → 22Claude narrowClaude narrow: Tool's count 22, Script count 2222 → 22

Sales Navigator stops at 15 operators. Every string here is over it.

Source: our test, counted by script

Show the data
Tool's countScript count
Gemini broad, run 23542
Gemini narrow, run 12831
Gemini narrow, run 22123
Claude broad2222
Claude narrow2222

The fix: count yourself. In a text editor, use Find for "(", ")", " OR ", " AND " and " NOT ". If "(" and ")" differ, the string is broken. Over the limit? Ask for a cut:

I will run the LinkedIn string in Sales Navigator, which allows at most 15 Boolean operators (AND, OR, NOT) in one search. Rewrite the broad LinkedIn string so it has 15 or fewer. Keep every must-have, drop the weakest terms first, and list what you dropped. Count the operators one by one under the string.

Gemini hit exactly 15, and this time its count was right:

(Go OR Java OR Kotlin) AND (Payments OR Ledger OR Billing OR "Money movement") AND (PostgreSQL OR Postgres) AND (Kafka OR "event streaming") AND ("Backend Engineer" OR "Software Engineer" OR "Go Engineer") NOT (frontend OR German)

But look at what it gave up. It dropped "Golang", on the assumption that "Go" would cover it, and kept the German exclusion. Claude made the opposite call for the same reason: "A bare Go matches nearly every profile, so I used Golang and Go phrases instead." We'd run the audit first, then the cut, though we didn't test that order.

6. Past Google's 32 words

Gemini's broad Google X-ray, second run:

site:linkedin.com/in (Go OR Golang OR Java OR Kotlin) (Payments OR Fintech OR Ledger OR Billing OR Payouts OR "Money movement") (PostgreSQL OR Postgres) (Kafka OR "event streaming") ("Backend Engineer" OR "Software Engineer") -frontend -german -deutsch

Gemini reported 25 words. Counted Google's way, terms plus operators, it's about 35, and Google ignores what comes after word 32. After the audit, Gemini claimed 17 words; we counted about 32.

The fix: count terms and operators together, and cut synonyms until you're well under. Claude's came in at 26 and 24 words, counted right.

7. NEAR and wildcards the board may not have

Gemini's narrow job board string, second run:

(Go OR Golang) AND ("payment system" OR "payment processing" OR Ledger OR Payout*) AND (PostgreSQL OR Postgres) AND (Kafka OR "event streaming") AND (Backend OR "Software Engineer") NEAR/3 (Engineer* OR Developer) AND (idempotency OR Kubernetes OR "PCI DSS") NOT (frontend OR "front end" OR German OR Deutsch)

The prompt only said "standard Boolean". Gemini assumed wildcards and proximity anyway: "I will use NEAR/5 as an example; if not supported, replace with AND." Asked for unsupported operators, the audit answered "None (based on stated assumptions)." On LinkedIn, where the prompt spelled out the rules, neither tool used either.

What surprised us: in its first run, on the same prompt, Gemini said the opposite: "I am not assuming wildcard * or NEAR operators unless explicitly specified by the job board platform." That run broke differently: more than 200,000 characters of blank space swallowed its keyword table and the start of the broad LinkedIn string. One run is not a verdict.

The fix: check the board's help page, and ask for a plain version too. Claude left them out of the board strings and said why: "job boards differ on hyphens, wildcards and stemming, so I avoided hyphens and wildcards."

The prompt, and the audit that caught what the rules missed

Maya at a corkboard, pinning keyword groups next to a job description

Four labeled blocks: list your platforms in TASK and match the platform rules in CONTEXT to them. The rest held up: no string from either tool used a school, a graduation year or an age word.

PERSONA
You are an experienced technical sourcer. You turn a job description into search strings that a recruiter will check and run by hand. You do not decide who gets contacted.

TASK
Read the job description below and build Boolean search strings to find people who could do this job, for these places:
[list your platforms, for example: LinkedIn keyword search, Google X-ray of public LinkedIn profiles, a job board CV database]

CONTEXT
Job description:
[paste the role, must-haves, nice-to-haves and what is not needed]

Rules:
- Use only skills, job titles and experience from the job description. Never add terms for age, gender, nationality, ethnicity, religion, family status or any other protected trait, and no proxies for them (graduation years, "young", "digital native", "recent graduate", schools, military units, ethnic or gendered words).
- Include the real-world job title variants people use for this work, not only the title in the job description. Say which ones you added and why.
- Do not filter on years of experience with dates or seniority words that would drop people. Leave seniority to the human review.
- LinkedIn keyword search supports only AND, OR, NOT, quotation marks and parentheses. Operators must be in capital letters. No wildcards (*), no + or -, no NEAR, no field operators, straight quotes only.
- Google: use site: and quotation marks, OR in capitals, - to exclude. Keep each Google string under 32 words, because Google ignores words after that.
- For every string, count the opening and closing parentheses and the Boolean operators (AND, OR, NOT), and write the counts under the string.
- If you are not sure a platform supports something, say so instead of guessing.
- Sales Navigator allows at most 15 AND, OR and NOT per string; Recruiter and Recruiter Lite have no limit.
- Never use NOT or - on anything the job description lists as not needed.
- Job board: [paste the operators from your board's help page]. Use nothing else; no * or NEAR unless listed.

FORMAT
1. A keyword map table: Group | Terms | Why
2. For each platform: one broad string and one narrow string, each in its own code block, with the counts under it and one line on when to use it.
3. A section "Who these strings will miss": people who could do the job but would not match, and one way to find them.
4. A short list of assumptions you made.

We tested the last three rules later, blind in Claude Opus 5.5 and in Gemini 3.8 Flash (newer than the first test's model). Both kept them: no NOT on German, no * or NEAR, Sales Navigator strings within 15, counts right. Gemini still gated two nice-to-haves, and Claude still excluded "recruiter". Keep the audit.

Then send this audit on every answer, before you use a single string:

Check every string you wrote. For each one:
- Count the opening and closing parentheses and each AND, OR and NOT, one by one, and compare with the counts you wrote. Show both.
- List any operator the platform does not support.
- List any NOT that removes people the job description allows. "Not needed" is not the same as "not wanted".
- List any group that turns a nice-to-have into a requirement.
Then show the corrected strings.

On Gemini, it removed the German and UI exclusions and the nice-to-have group. It didn't fix the counts or question its own NEAR. On Claude, it removed the recruiter exclusions, the nice-to-have group and a Germany-only Google filter, since "Relocation within the EU is supported". The audit fixes logic; the numbers and the limits stay your job. Before you run any string, go down this list:

[ ] Every NOT: "this removes anyone who..." Is that someone the job allows?
[ ] Every AND group: is it a must-have, or a nice-to-have in disguise?
[ ] Is the "broad" string really broad, or five gates long?
[ ] Every - or NOT on a common word like recruiter: who else writes it?
[ ] Operators counted by you, against the platform's limit (15 in Sales Navigator)
[ ] Google: under 32 words, counting terms and operators
[ ] Job board: no *, NEAR or other operator its help page doesn't list

If people in your market write profiles in their own language, this follow-up adds local terms:

The role is in [country]. Add the job titles and skill words people there use in the local language on their profiles, and show the broad LinkedIn string again with them. Mark which terms you added.

Gemini added German titles, kept the German exclusion, and grew the string to 69 operators by its own count. Have someone from that market read the list.

Who a bad string shuts out

A Berlin search with NOT German in it returns a clean list, and nobody sees the people who never show up. That's where a Boolean string's bias lives. In our test, a plain "not needed" line became that exclusion, and only the audit caught it. Watch for NOT on languages, locations or nationalities, and for lists of "top" schools or companies.

The people you find have rights too. Once a sourced profile sits in a spreadsheet or your ATS, you hold their personal data, and in some places you must tell them where you got it (GDPR Article 14). Search on job-related skills only, and be ready to explain why each part of a string is there.

Keep a person between the string and the message. Once a tool searches and contacts people on its own, one bad NOT removes a whole group with no one looking. Before sourcing that way at scale, check with your lawyer; this isn't legal advice.

Next step: write the message they answer

Your strings give you a pool of profiles. The next guide shows how to write outreach messages with AI that get a reply. If the strings keep coming back thin, the problem may be upstream: write a clearer job description with AI first.

This article is general information, not legal advice. Laws differ by country and change often, so consult your lawyer before you rely on it for your situation.

Keep reading