lmlucene reference
CLI options, host functions, Lucene domain types, SAM callback interfaces, standard REST and CLI interfaces, and exit codes for lmlucene.
CLI flags and subcommands
| Command or flag | Description |
|---|---|
| lmlucene --version | Print the lmlucene version string and exit 0. |
| lmlucene --schema / --cli-schema | Print the cli.schema.v1 JSON contract describing the run operation. |
| lmlucene --lmcode-schema [--json] | Print the embedded lmcode/lucene.dsl.json schema summary or exact JSON bytes. |
| lmlucene --lmcode-signatures | Print sorted canonical signatures for all domain and standard catalog bindings. |
| lmlucene --lmcode FILE.dslb | Execute a compiled DSLB v6 bytecode program and emit the JSON return envelope. |
| lmlucene run --program FILE.dslb [--dryrun] [--readonly] | Run or dry-validate a compiled bytecode program (--readonly refuses execution because bytecode may write). |
| lmlucene run --input-json JSON / --input-file FILE | Supply the run operation parameters as a JSON object or JSON file. |
Host functions and enums (lucene.dsl.json)
| Signature or enum | Return type | Description |
|---|---|---|
| enum Occur / OpenMode / SortType | Enum | Occur: MUST, SHOULD, MUST_NOT, FILTER; OpenMode: CREATE, APPEND, CREATE_OR_APPEND; SortType: LONG, STRING. |
| fn memory_directory() / fs_directory(path: string) | Directory | Create an in-memory ByteBuffersDirectory or a filesystem NIOFSDirectory. |
| fn standard_analyzer() / english_analyzer() / whitespace_analyzer() / keyword_analyzer() | Analyzer | Create a built-in Lucene Analyzer instance. |
| fn rule_analyzer(entry_name: string) | Analyzer | Create an analyzer that applies the named TokenTransform SAM rule after StandardAnalyzer. |
| fn writer_config(analyzer: Analyzer) / index_writer(dir: Directory, cfg: WriterConfig) | WriterConfig / IndexWriter | Configure and open a Lucene IndexWriter. |
| fn directory_reader(dir: Directory) / index_searcher(reader: DirectoryReader) | DirectoryReader / IndexSearcher | Open a point-in-time index reader and create a searcher over it. |
| fn document() / facet_config() | Document / FacetConfig | Create a mutable Document builder or a FacetConfig for sorted-set facet fields. |
| fn term_query(f: string, t: string) / prefix_query(f: string, p: string) / parse_query(f: string, q: string, a: Analyzer) | Query | Build a TermQuery, PrefixQuery, or QueryParser query. |
| fn boolean_query() / all_query() / long_range(f: string, min: int, max: int) | BooleanQuery / Query | Build a BooleanQuery builder, MatchAllDocsQuery, or LongPoint range query. |
| fn knn_query(f: string, vec: FloatList, k: int[, filter: Query]) / drill_down(cfg: FacetConfig, base: Query, dim: string, val: string) | Query | Build a KnnFloatVectorQuery (with optional pre-filter) or a facet DrillDownQuery. |
| fn report(label: string, value: string) / print(msg: string) / assert_true(cond: bool, msg: string) | void | Record detail values in result.details, print to stderr, or assert conditions. |
Domain types and methods
| Type | Methods |
|---|---|
| Document | text(field, val, stored), vector_text(field, val, stored) (text with term vectors), keyword(field, val, stored), stored(field, val), number(field, val, stored), sort_number(field, val), sort_keyword(field, val), facet(dim, val), vector(field, floats: FloatList), get(field), has(field). |
| IndexWriter / WriterConfig | IndexWriter: add(doc), update(field, term, doc), delete(field, term), commit(), rollback(), reader(), close(); WriterConfig: open_mode(OpenMode), ram_mb(float). |
| DirectoryReader / TermVectors / VectorTerm | DirectoryReader: num_docs(), term_vectors(doc_id, field), close(); TermVectors: len(), at(int); VectorTerm: term(), len(), at(int), tokens(). |
| IndexSearcher | search(query, k), search_after(query, hit, k), sorted_search(query, field, SortType, reverse, k), count(query), explain(query, doc_id), facets(query, facet_config, dim, top_n), bm25(k1, b), similarity_rule(entry_name). |
| TopDocs / Hit / FacetCounts | TopDocs: total(), len(), at(int), emit(label); Hit: doc_id(), score(), document(); FacetCounts: total(), len(), label(int), value(int), count(label), emit(label). |
| FacetConfig / BooleanQuery / Directory | FacetConfig: multi_valued(dim), build(doc); BooleanQuery: add(query, Occur), build(); Directory: close(). |
| Analyzer / Tokens / Token / CollectionStats | Analyzer: tokens(field, text), close(); Tokens: len(), at(int), emit(label); Token: term(), start(), end(), position(); CollectionStats: field(), doc_count(), total_terms(), doc_freq(), boost(). |
SAM callback interfaces and standard REST/CLI interfaces
| Interface | Signature | Role |
|---|---|---|
| TokenTransform | (token: string) -> string | SAM interface wired via rule_analyzer(entry_name) to transform tokens during analysis. |
| FieldWeight | (stats: CollectionStats) -> float | SAM interface wired via searcher.similarity_rule(entry_name) to scale BM25 field scoring. |
| RestGet..RestOptions, RestHandler | (exchange: RestExchange) -> void | Standard lmcode_std_v3 HTTP route handler interfaces supporting :param and {param} (current main; the v0.1.19 release predates them). |
| CliCommand, CliOption | (exchange: RestExchange) -> void | Standard lmcode_std_v3 stateless CLI handler interfaces dispatched by rest_cli. |
Exit codes
| Code | Meaning |
|---|---|
| 0 | Execution, dry-run validation, or schema introspection succeeded. |
| 2 | CLI argument usage error or LMScript compilation error. |
| 3 | Bytecode load error, schema mismatch, runtime Lucene/callback failure, or --readonly policy refusal. |