Skip to content

Searcher

Overview

Module

Full-text search over the documents previously indexed via Writer. The query string uses Lucene query syntax — field-qualified (title:invoice), boolean (title:invoice AND status:open), wildcard (invoice*), fuzzy (invoice~). Results are returned as a JSON document with location, content excerpt, and metadata for each hit.

Indexes are named so the same JVM can host multiple corpora (products, orders, docs); the index name on every call selects which corpus to search.

Key Features:

  • Lucene query syntax — boolean, wildcard, fuzzy, field-qualified.
  • Multi-corpus — name-isolated indexes share one JVM.
  • JSON output — easy to forward straight into a controller response.

Example Usage:

java
import org.eclipse.dirigible.sdk.indexing.Searcher;

String hits = Searcher.search("products", "title:headphones AND status:active");

Methods

Runs a Lucene query against the named index.

java
public static String search(String index, String term) throws IOException;
ParameterTypeDescription
indexStringIndex name.
termStringLucene query string.

Returns

  • Type: String
  • Description: JSON document with one entry per matching document.

Released under the EPL-2.0 License.