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 flagDescription
lmlucene --versionPrint the lmlucene version string and exit 0.
lmlucene --schema / --cli-schemaPrint 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-signaturesPrint sorted canonical signatures for all domain and standard catalog bindings.
lmlucene --lmcode FILE.dslbExecute 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 FILESupply the run operation parameters as a JSON object or JSON file.

Host functions and enums (lucene.dsl.json)

Signature or enumReturn typeDescription
enum Occur / OpenMode / SortTypeEnumOccur: MUST, SHOULD, MUST_NOT, FILTER; OpenMode: CREATE, APPEND, CREATE_OR_APPEND; SortType: LONG, STRING.
fn memory_directory() / fs_directory(path: string)DirectoryCreate an in-memory ByteBuffersDirectory or a filesystem NIOFSDirectory.
fn standard_analyzer() / english_analyzer() / whitespace_analyzer() / keyword_analyzer()AnalyzerCreate a built-in Lucene Analyzer instance.
fn rule_analyzer(entry_name: string)AnalyzerCreate an analyzer that applies the named TokenTransform SAM rule after StandardAnalyzer.
fn writer_config(analyzer: Analyzer) / index_writer(dir: Directory, cfg: WriterConfig)WriterConfig / IndexWriterConfigure and open a Lucene IndexWriter.
fn directory_reader(dir: Directory) / index_searcher(reader: DirectoryReader)DirectoryReader / IndexSearcherOpen a point-in-time index reader and create a searcher over it.
fn document() / facet_config()Document / FacetConfigCreate 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)QueryBuild a TermQuery, PrefixQuery, or QueryParser query.
fn boolean_query() / all_query() / long_range(f: string, min: int, max: int)BooleanQuery / QueryBuild 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)QueryBuild 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)voidRecord detail values in result.details, print to stderr, or assert conditions.

Domain types and methods

TypeMethods
Documenttext(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 / WriterConfigIndexWriter: add(doc), update(field, term, doc), delete(field, term), commit(), rollback(), reader(), close(); WriterConfig: open_mode(OpenMode), ram_mb(float).
DirectoryReader / TermVectors / VectorTermDirectoryReader: num_docs(), term_vectors(doc_id, field), close(); TermVectors: len(), at(int); VectorTerm: term(), len(), at(int), tokens().
IndexSearchersearch(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 / FacetCountsTopDocs: total(), len(), at(int), emit(label); Hit: doc_id(), score(), document(); FacetCounts: total(), len(), label(int), value(int), count(label), emit(label).
FacetConfig / BooleanQuery / DirectoryFacetConfig: multi_valued(dim), build(doc); BooleanQuery: add(query, Occur), build(); Directory: close().
Analyzer / Tokens / Token / CollectionStatsAnalyzer: 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

InterfaceSignatureRole
TokenTransform(token: string) -> stringSAM interface wired via rule_analyzer(entry_name) to transform tokens during analysis.
FieldWeight(stats: CollectionStats) -> floatSAM interface wired via searcher.similarity_rule(entry_name) to scale BM25 field scoring.
RestGet..RestOptions, RestHandler(exchange: RestExchange) -> voidStandard lmcode_std_v3 HTTP route handler interfaces supporting :param and {param} (current main; the v0.1.19 release predates them).
CliCommand, CliOption(exchange: RestExchange) -> voidStandard lmcode_std_v3 stateless CLI handler interfaces dispatched by rest_cli.

Exit codes

CodeMeaning
0Execution, dry-run validation, or schema introspection succeeded.
2CLI argument usage error or LMScript compilation error.
3Bytecode load error, schema mismatch, runtime Lucene/callback failure, or --readonly policy refusal.