Skip to content
SearchJet
Updated August 10, 2026

Using the Query Builder

The package provides a fluent query builder for more complex searches, including Gutenberg-specific filters. Chain methods together to build precise search queries with readable syntax.


Search with Gutenberg Content Filters

SearchJet automatically indexes Gutenberg block content. Use the query builder to search within specific block types or content sections.

use SearchJet\SearchJet;

$results = SearchJet::search('api integration')
    ->filter('post_type', 'post')
    ->filter('category', 'documentation')
    ->sortBy('date', 'desc')
    ->limit(10)
    ->get();

Advanced Filtering

Combine multiple filters to narrow results precisely. The query builder supports AND logic between filters and OR logic within a single filter field.

$results = SearchJet::search('search plugin')
    ->filter('tags', ['wordpress', 'search'])
    ->filter('author', 'admin')
    ->highlight(['title', 'content'])
    ->get();

Available Query Methods

  • search(): Set the search query string.
  • filter(): Add a field filter with AND logic.
  • sortBy(): Order results by a specific field.
  • limit(): Set maximum results to return.
  • paginate(): Get paginated results with page number and size.
  • highlight(): Wrap matching terms in HTML tags for display.
  • get(): Execute the query and return results.

Was this article helpful?

Ready to add search to your project?

Start free. No credit card required. Deploy in under 10 minutes.