Liking cljdoc? Tell your friends :D

boundary.search.core.query

Pure query-building functions for full-text search.

Two query paths:

  • PostgreSQL: to_tsvector/plainto_tsquery + ts_rank + ts_headline
  • Fallback (H2/SQLite): LOWER/LIKE-based search

Filter support: callers may pass a :filters map of keyword->string pairs. Filter values are matched against the JSON "filters" column using DB-appropriate JSON path syntax.

Pure query-building functions for full-text search.

Two query paths:
- PostgreSQL: to_tsvector/plainto_tsquery + ts_rank + ts_headline
- Fallback (H2/SQLite): LOWER/LIKE-based search

Filter support: callers may pass a :filters map of keyword->string pairs.
Filter values are matched against the JSON "filters" column using
DB-appropriate JSON path syntax.
raw docstring

build-fallback-count-sqlclj

(build-fallback-count-sql index-id entity-type query filters)

Build a parameterized count SQL for fallback search.

Args: index-id - string entity-type - string query - string filters - map of keyword->any (optional, nil treated as empty)

Returns: JDBC SQL vector [sql & params]

Build a parameterized count SQL for fallback search.

Args:
  index-id    - string
  entity-type - string
  query       - string
  filters     - map of keyword->any (optional, nil treated as empty)

Returns:
  JDBC SQL vector [sql & params]
sourceraw docstring

build-fallback-search-sqlclj

(build-fallback-search-sql index-id entity-type query limit offset filters)

Build a parameterized JDBC SQL vector for LIKE-based fallback search.

Used for H2 (tests) and SQLite. Returns a static rank of 1.0, no snippet.

Args: index-id - string entity-type - string query - string (user search query) limit - integer offset - integer filters - map of keyword->any (optional, nil treated as empty)

Returns: JDBC SQL vector [sql & params]

Build a parameterized JDBC SQL vector for LIKE-based fallback search.

Used for H2 (tests) and SQLite. Returns a static rank of 1.0, no snippet.

Args:
  index-id    - string
  entity-type - string
  query       - string (user search query)
  limit       - integer
  offset      - integer
  filters     - map of keyword->any (optional, nil treated as empty)

Returns:
  JDBC SQL vector [sql & params]
sourceraw docstring

build-fallback-suggest-sqlclj

(build-fallback-suggest-sql index-id entity-type query limit)

Build a LIKE-based fallback suggest query for H2/SQLite.

Args: index-id - string entity-type - string query - string limit - integer

Returns: JDBC SQL vector [sql & params]

Build a LIKE-based fallback suggest query for H2/SQLite.

Args:
  index-id    - string
  entity-type - string
  query       - string
  limit       - integer

Returns:
  JDBC SQL vector [sql & params]
sourceraw docstring

build-postgres-count-sqlclj

(build-postgres-count-sql index-id entity-type language query filters)

Build a parameterized JDBC SQL vector for counting PostgreSQL FTS results.

Args: index-id - string entity-type - string language - string query - string filters - map of keyword->any (optional, nil treated as empty)

Returns: JDBC SQL vector [sql & params]

Build a parameterized JDBC SQL vector for counting PostgreSQL FTS results.

Args:
  index-id    - string
  entity-type - string
  language    - string
  query       - string
  filters     - map of keyword->any (optional, nil treated as empty)

Returns:
  JDBC SQL vector [sql & params]
sourceraw docstring

build-postgres-search-sqlclj

(build-postgres-search-sql index-id
                           entity-type
                           language
                           query
                           limit
                           offset
                           highlight?
                           filters)

Build a parameterized JDBC SQL vector for PostgreSQL FTS search.

Uses a CTE to compute the tsvector and tsquery once, then ranks and optionally highlights results. Uses plainto_tsquery for safe handling of arbitrary user input (no FTS syntax required).

Args: index-id - string (e.g. "product-search") entity-type - string (e.g. "product") language - string FTS config (e.g. "english") query - string (user search query) limit - integer offset - integer highlight? - boolean filters - map of keyword->any (optional, nil treated as empty)

Returns: JDBC SQL vector [sql & params]

Build a parameterized JDBC SQL vector for PostgreSQL FTS search.

Uses a CTE to compute the tsvector and tsquery once, then ranks
and optionally highlights results. Uses plainto_tsquery for safe
handling of arbitrary user input (no FTS syntax required).

Args:
  index-id    - string (e.g. "product-search")
  entity-type - string (e.g. "product")
  language    - string FTS config (e.g. "english")
  query       - string (user search query)
  limit       - integer
  offset      - integer
  highlight?  - boolean
  filters     - map of keyword->any (optional, nil treated as empty)

Returns:
  JDBC SQL vector [sql & params]
sourceraw docstring

build-postgres-suggest-sqlclj

(build-postgres-suggest-sql index-id entity-type query limit threshold)

Build a parameterized SQL vector for trigram similarity suggestions.

Requires: CREATE EXTENSION IF NOT EXISTS pg_trgm;

Args: index-id - string entity-type - string query - string (partial user input) limit - integer threshold - number (similarity threshold, e.g. 0.15)

Returns: JDBC SQL vector [sql & params]

Build a parameterized SQL vector for trigram similarity suggestions.

Requires: CREATE EXTENSION IF NOT EXISTS pg_trgm;

Args:
  index-id    - string
  entity-type - string
  query       - string (partial user input)
  limit       - integer
  threshold   - number (similarity threshold, e.g. 0.15)

Returns:
  JDBC SQL vector [sql & params]
sourceraw docstring

empty-query?clj

(empty-query? query)

Returns true if the query is effectively empty after sanitization.

Returns true if the query is effectively empty after sanitization.
sourceraw docstring

sanitize-queryclj

(sanitize-query query)

Remove FTS-unsafe characters from a user query string.

Args: query - raw user input string

Returns: Sanitized string safe for use in FTS functions, or nil

Remove FTS-unsafe characters from a user query string.

Args:
  query - raw user input string

Returns:
  Sanitized string safe for use in FTS functions, or nil
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close