全部文章
寻访与沟通

如何用 Claude 或 Gemini 写布尔搜索式(以及为什么总出错)

用 Claude 或 Gemini 写布尔搜索式:先给岗位和平台规则,再逐个检查 NOT、AND 组和运算符数量上限。

  • Saves time
  • Better hires

2026年10月7日 · 13 分钟阅读

提示词为英文:在各类AI工具中英文提示词效果最佳。

Gemini 在它那条宽泛的 LinkedIn 搜索式下面写了"35"。我们数出来是 42 个布尔运算符。而 Sales Navigator 最多只允许 15 个。

这只是我们测试中搜索式出错的七种情况之一。没有一处是笔误:每个括号都配对正确。但每一处都在悄悄漏掉岗位想要的人。

**简短回答:**把职位描述粘贴给 Claude 或 Gemini,告诉它你要搜索的平台以及该平台支持什么,让它给出一条宽泛版和一条精确版,并数清运算符。然后发送下面的审查提示词:它能揪出不合理的 NOT 和把加分项当必备项的 AND 门槛,但查不出数量和上限问题。每个 NOT 都要自己读一遍,因为岗位上的"不需要"不等于"不想要",还要对照平台上限数一数运算符。Gemini 数错了;Claude 用脚本数对了,但写出的搜索式对 Sales Navigator 来说太长。

对号入座:你看到的症状

你看到的现象 可能原因 解决办法
柏林的搜索结果里没有会德语的人 对语言用了 NOT 1
常见岗位却几乎没有结果 加分项用 AND 连接,或"宽泛"搜索式门槛太多 2、3
做过招聘工具的工程师不见了 -recruiter 排除词 4
搜索式对 Sales Navigator 太长 运算符太多,数错了 5
Google 好像不理你最后几个词 超过 32 个词 6
招聘网站的搜索式里满是 NEAR/5 和 * 网站可能不支持的运算符 7

下面每条搜索式背后的岗位

岗位:Pelican Pay 支付团队的高级后端工程师。Pelican Pay 是我们虚构的一家柏林金融科技公司,120 人。我们根据下面这份职位描述,分别要了 LinkedIn、Google X-ray 和招聘网站简历库的搜索式:

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 收到两次提示词(另有三次追问)。Claude Opus 5.5 回答了一次,外加审查,而且它事先完全不知道我们设了哪些陷阱。一个小脚本负责数每个括号和运算符。提示词里的平台规则来自 LinkedIn Help 和 GoogleGuide,后者给出的 Google 上限是 32 个词,词、检索项和运算符合在一起算。

1. 岗位写的是"不需要",搜索式理解成了"不要"

Maya 举着一条长长的纸链,中间有一环被扯开了

这是 Gemini 第二次运行时生成的宽泛 LinkedIn 搜索式。请看最后一组。

(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)

岗位说的是不需要德语。NOT (... German OR Deutsch ...) 会把所有在档案里写了德语的人都剔除,而这是个柏林的岗位;提到 UI 或 UX 的人也一并被剔除。语言常常被当成一个人来自哪里的替代信号,所以要先查这个问题。它不留痕迹:那些人只是不出现而已。

它还延续到了我们在审查之前针对该回答发出的两次追问里:Gemini 改写的 Sales Navigator 搜索式仍以 NOT (frontend OR German) 结尾,带德语职位名称的搜索式也一样。

**解决办法:**删掉 NOT 组,或者只保留岗位真正排除的内容。对每个 NOT,大声把这句话说完:"这会排除所有……的人"。Claude 没人提醒就这么做了,它没有排除 frontend,理由是"后端能力强的全栈人才会被误伤"。它的审查结论是:"'Frontend'、'German' 和 'degree' 是职位描述里写明不需要的东西,而不是它要拒绝的东西。"对 Gemini 来说,提示词里的规则没能拦住对德语的排除,临近结尾的审查才拦住了。

2. 四个加分项,被升级成了必备项

Gemini 第二次运行的精确版 LinkedIn 搜索式:

(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)

最后那个 AND 组把四个加分项变成了硬性要求。Gemini 两次运行都这样做了。Claude 的招聘网站精确版搜索式也是,它以 AND (PCI OR idempotency OR "distributed transactions" OR Kubernetes OR PSP OR neobank OR fintech OR bank) 结尾。Claude 自己在下面注明了这一点,它的审查也删掉了这个组:"违反规则。"

**解决办法:**把这个组删掉。审查之后,Gemini 的精确版搜索式只保留了必备项:

(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. 有五道门槛的"宽泛"搜索式

回到失误 1 里的那条搜索式。档案上要同时有:语言 AND 支付相关词 AND PostgreSQL AND Kafka AND 列出的职位名称。很少有人会把整套技术栈都写出来,所以这条"宽泛"搜索一开始就很窄。

**解决办法:**宽泛版只保留人们实际会写的必备项。Claude 审查后的版本只有三个组:职位、语言和领域,地点则交给 LinkedIn 的筛选器:

("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)

先运行这条,读完前 20 份档案,再考虑用精确版。它有 20 个运算符,用于 Recruiter 没问题,但对 Sales Navigator 来说太多了(见第 5 条)。

4. -recruiter 也会排除做过招聘工具的工程师

Claude 的宽泛版 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"

理由是:"招聘人员的档案里满是这些关键词。"但减号并不知道这个词是谁写的。做过招聘产品的工程师会被排除,那位"与人才招聘团队合作组建了团队"的技术负责人也一样。

**解决办法:**去掉这个排除词。用 Claude 的话说:"漏进来的招聘人员档案,人工筛选时很快就能剔除。"几份不相关的档案只会让你多翻几秒。而漏掉的工程师,是你永远看不到的候选人。

5. 数错了,以及数对了却超限

Sales Navigator 一次搜索最多允许 15 个布尔运算符,而 Recruiter 和 Recruiter Lite 没有上限(LinkedIn Help)。Gemini 一而再再而三地数错:

  • 失误 1 里 Gemini 的宽泛搜索式:它说有 35 个运算符、10 对括号。实际是 42 个运算符、6 对括号。
  • Gemini 第一次运行的精确版 LinkedIn 搜索式:它说 28 个,实际是 31 个。
  • 即使在审查之后,Gemini 在一条 Google 搜索式下面写了 15 个运算符,而它实际只有 11 个。

Claude 在能运行代码的会话里,六条全数对了(它的审查里说是"一个小脚本")。在更早、没有工具的一次运行里,六条中有三条差了一个。它的问题出在上限:两条 LinkedIn 搜索式都有 22 个运算符,而它写道"LinkedIn 没有公布关键词搜索的长度限制"。两条搜索式在 Sales Navigator 里都跑不了。

LinkedIn 搜索式中的布尔运算符:工具自报数量与我们实数
工具自报脚本实数Gemini 宽泛版,第 2 次Gemini 宽泛版,第 2 次: 工具自报 35, 脚本实数 4235 → 42Gemini 精确版,第 1 次Gemini 精确版,第 1 次: 工具自报 28, 脚本实数 3128 → 31Gemini 精确版,第 2 次Gemini 精确版,第 2 次: 工具自报 21, 脚本实数 2321 → 23Claude 宽泛版Claude 宽泛版: 工具自报 22, 脚本实数 2222 → 22Claude 精确版Claude 精确版: 工具自报 22, 脚本实数 2222 → 22

Sales Navigator 最多 15 个运算符。这里的每条搜索式都超了。

Source: 我们的测试,脚本统计

Show the data
工具自报脚本实数
Gemini 宽泛版,第 2 次3542
Gemini 精确版,第 1 次2831
Gemini 精确版,第 2 次2123
Claude 宽泛版2222
Claude 精确版2222

**解决办法:**自己数。在文本编辑器里用查找功能分别查 "("、")"、" OR "、" AND " 和 " NOT "。如果 "(" 和 ")" 的数量不一致,说明搜索式有误。超限了?让它缩短:

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 刚好压到 15 个,这次它数对了:

(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)

不过看看它舍弃了什么。它去掉了 "Golang",以为 "Go" 能涵盖它,却保留了对德语的排除。Claude 出于同样的原因做了相反的取舍:"单独一个 Go 几乎能匹配所有档案,所以我用了 Golang 和包含 Go 的短语。"我们会先做审查,再做缩减,不过这个顺序我们没有测试过。

6. 超出 Google 的 32 个词

Gemini 第二次运行的宽泛版 Google X-ray:

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 报告说 25 个词。按 Google 的算法,检索项加运算符一起算,大约是 35 个,而 Google 会忽略第 32 个词之后的内容。审查之后,Gemini 称是 17 个词;我们数出来约 32 个。

**解决办法:**把检索项和运算符放在一起数,砍掉同义词,直到明显低于上限。Claude 的两条分别是 26 和 24 个词,数得没错。

7. 招聘网站可能不支持 NEAR 和通配符

Gemini 第二次运行的精确版招聘网站搜索式:

(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)

提示词里只说了"标准布尔"。Gemini 还是假定可以用通配符和邻近运算符:"我将用 NEAR/5 作为示例;如果不支持,请替换为 AND。"当被问到有哪些不支持的运算符时,审查的回答是"无(基于所述假设)"。在 LinkedIn 上,提示词把规则写明了,两个工具都没有用到这两种运算符。

**让我们意外的是:**Gemini 第一次运行时,面对同一份提示词,说的恰恰相反:"除非招聘网站平台明确说明,否则我不会假定支持通配符 * 或 NEAR 运算符。"那次运行则是另一种出错方式:超过 20 万个字符的空白吞掉了它的关键词表和宽泛版 LinkedIn 搜索式的开头。一次运行不能下结论。

**解决办法:**查看网站的帮助页面,并要求同时给一个简单版。Claude 在招聘网站搜索式里没有用这些运算符,并说明了原因:"招聘网站对连字符、通配符和词干处理各不相同,所以我避开了连字符和通配符。"

提示词,以及抓住规则漏掉问题的审查

Maya 站在软木板前,把关键词组和职位描述钉在一起

四个带标签的模块:在 TASK 里列出你的平台,并在 CONTEXT 里写上与之对应的平台规则。其余部分都经受住了检验:两个工具的搜索式都没有用到学校、毕业年份或年龄相关的词。

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.

我们后来在 Claude Opus 5.5 和 Gemini 3.8 Flash(比第一次测试的模型更新)上盲测了最后三条规则。两者都遵守了:没有对德语用 NOT,没有 * 或 NEAR,Sales Navigator 搜索式都在 15 个以内,数得也对。不过 Gemini 仍然给两个加分项设了门槛,Claude 仍然排除了"recruiter"。审查这一步要保留。

然后,在使用任何一条搜索式之前,对每个回答都发送这个审查提示词:

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.

在 Gemini 上,它去掉了对德语和 UI 的排除,以及加分项那个组;但没有纠正数量,也没有质疑它自己用的 NEAR。在 Claude 上,它去掉了对 recruiter 的排除、加分项那个组,以及只限德国的 Google 筛选,因为"支持欧盟内部迁居"。审查能修正逻辑;数量和上限仍然要你自己把关。运行任何搜索式之前,对照这份清单过一遍:

[ ] 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

如果你所在市场的人习惯用本国语言写档案,可以用这条追问加入本地用语:

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 加入了德语职位名称,保留了对德语的排除,按它自己的统计,搜索式增长到了 69 个运算符。请让该市场的人看一遍这份清单。

糟糕的搜索式会把谁挡在门外

带有 NOT German 的柏林搜索,会返回一份干净的名单,没人会注意到那些从未出现的人。布尔搜索式的偏见就藏在这里。在我们的测试中,一句普通的"不需要"变成了这样的排除,而且只有审查发现了它。要留意对语言、地点或国籍使用的 NOT,也要留意"顶尖"院校或公司的名单。

被你搜到的人同样有权利。一旦搜到的档案进入表格或你的 ATS,你就持有了他们的个人数据,在某些地方你还必须告知他们信息来源(GDPR 第 14 条)。只按与岗位相关的技能搜索,并准备好解释搜索式里每一部分为什么存在。

在搜索式和消息之间留一个真人。一旦工具开始自动搜索并联系候选人,一个错误的 NOT 就会在没人察觉的情况下排除掉一整个群体。大规模这样做寻访之前,请先咨询你的律师;这不是法律意见。

下一步:写一条对方会回复的消息

搜索式给你的是一批档案。下一篇指南讲如何用 AI 写能得到回复的触达消息。如果搜出来的结果总是很少,问题可能出在更前面:先用 AI 写一份更清晰的职位描述。

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.

继续阅读