Boolean Query Input

Shows how a search engine will group AND and OR in a boolean query, so a search doesn't quietly return the wrong people.

StopsBoolean search returns the wrong people

Installation

pnpm dlx shadcn@latest add https://bollard-ui.vercel.app/r/boolean-query-input.json

The files land in your project. They're yours to edit.

Usage

boolean-query-input-usage.tsx
import { BooleanQueryInput } from "@/components/ui/boolean-query-input"

<BooleanQueryInput label="Search candidates" value={query} onValueChange={setQuery} placeholder='e.g. ("product manager" OR PM) AND fintech' />

What it catches

  • Mixed AND/OR without brackets, read back with the engine's implied grouping
  • Unclosed quotes or brackets, and curly quotes
  • Square brackets used instead of parentheses
  • Lowercase and/or that engines search as words
  • Dangling operators at the start or end

Props

BooleanQueryInput props
PropTypeDefault
label

Visible label.

string"Search"
value

Controlled query.

string—
defaultValue

Initial query when uncontrolled.

string""
onValueChange

Called with the query on every change and fix.

(value: string) => void—
precedence

How your search engine groups AND and OR without brackets. LinkedIn and most engines apply AND first.

QueryPrecedence"and-first"
onIssuesChange

Called with the current issues once typing pauses, so a form can hold the search until they're fixed.

(issues: QueryIssue[]) => void—
delay

Pause in ms before warnings appear while typing. Leaving the field shows them at once.

number600
messages

Override any message or label.

Partial<typeof BOOLEAN_QUERY_MESSAGES>—

* required. Also accepts the native props of <input> (className, aria-*, data-*…), passed through to it.

Accessibility

  • Visible <label>; the input is described by the readback and status
  • Status and issues are aria-live="polite"
  • Fix buttons have aria-labels with the exact query they apply
  • Dismiss button has an aria-label

Only what the source does. Test with your own screen reader and content before shipping.

Limitations

  • Assumes AND binds first unless you set precedence; engines differ
  • Does not know engine-specific syntax beyond AND, OR, NOT, quotes and brackets

What it stops

Boolean search returns the wrong people

Also known as

boolean search · search query · and or not · recruiter search · advanced search · naukri · linkedin · sourcing

Field type

Dependencies

Pairs well with