AI Assistant is here! - Make the leap to conversational eCommerce

Boolean search

Search queries built with logical operators (AND, OR, NOT) that tell the engine exactly what to include, exclude, or treat as interchangeable.


Definition

Definition

You've probably used Boolean logic without knowing it. When you search for something online and add a minus sign before a word to exclude it, that's Boolean. When Google lets you type "red sneakers" -leather, it's applying the same logic that George Boole formalized in 1854 as a branch of algebra where every value is either true or false.

In search systems, Boolean logic translates into three core operators: AND, both terms must appear. jacket AND waterproof returns only products that match both conditions. Most search engines apply AND by default between words. OR, at least one term must appear. sneakers OR trainers broadens the result set to cover different ways users name the same thing. NOT (sometimes written as AND NOT or with a minus sign), excludes a term. boots NOT synthetic filters out results containing the excluded word. Operators can be combined and nested with parentheses to build complex queries: (jacket OR coat) AND waterproof NOT kids returns waterproof outerwear for adults, regardless of whether it's called a jacket or a coat.

At the index level, Boolean retrieval works by comparing the query against an inverted index, a data structure that maps each term to the list of documents containing it. The engine evaluates the logical expression and returns the intersection, union or difference of those document sets accordingly.

Boolean search is exact and deterministic: the same query always returns the same results, without ranking by relevance. This is a feature in contexts where precision matters more than discovery (a B2B buyer filtering a technical catalog by specification), and a limitation when the goal is surfacing the most relevant item from a broad query.

Modern search engines layer relevance scoring and natural language processing on top of Boolean logic rather than replacing it. A query engine might use BM25 or a vector model to rank results, but still use Boolean filters to enforce hard constraints, for example, only returning in-stock products within a specific price range, regardless of relevance score.

What it's used for

What it's used for

For an ecommerce marketer, Boolean logic surfaces in two practical places.

The first is search query analysis. When reviewing what users actually type in the search bar, Boolean patterns reveal intent gaps. A query like shirt -blue tells you a user is actively excluding a variant, which may signal poor filtering UX or a stock issue with blue shirts. The second is catalog and filter configuration. Many search administration panels expose Boolean conditions when setting up custom results, boosting rules, or exclusion lists. Knowing that category:shoes AND brand:Nike AND NOT sale:true is a Boolean expression makes it easier to build and debug those rules.

For a developer, Boolean search matters at the query construction layer. When building search integrations or writing queries against a search index, understanding how AND/OR/NOT affect the document sets retrieved is the difference between a filter that works and one that silently returns too many or too few results.

Doofinder

Doofinder's search configuration exposes Boolean-style logic in several places without requiring users to write raw query syntax. In Search Fields configuration, the relevance model determines which fields must match and which are optional — effectively an AND/OR weighting at the field level. In Excluded Results and Custom Results, the conditions applied (product ID, category, tag) are evaluated as Boolean constraints: a product either matches the condition or it doesn't, and the rule fires accordingly.

The Synonyms tool interacts with Boolean logic indirectly: when a synonym group is defined, the engine expands the query to an OR across all terms in the group before applying other filters. sneakers becomes sneakers OR trainers OR tennis shoes at query time.

For developers integrating via the API, Doofinder's query parameters allow combining filters that behave as AND conditions over indexed fields — price range, category, availability — stacked on top of the text relevance query.

Example

Case study

A sporting goods store sells running shoes across several brands and materials. A user searches for running shoes. The default query returns 340 results.

A developer adds a Boolean filter to the search layer: category:running AND in_stock:true AND NOT material:leather. The result set drops to 87 products — all in stock, in the right category, and relevant to a runner who wouldn't want leather shoes.

The marketer then reviews the stats and notices that queries containing trail return a high zero-results rate. They add a synonym rule: trail → trail OR mountain OR off-road. The OR expansion catches catalog entries tagged with alternative terms, recovering results for what was previously a dead-end query.

Before: 340 results with noise, some out of stock, some irrelevant categories.

After: 87 targeted results, higher click-through rate on the first page.