[114:14] (extern: com.lehman.aussomserver.connectors.AussomLuceneFileIndex) extends: object
A file-system-backed Lucene index. Index data is persisted to disk, allowing files to be added across multiple sessions. Example: idx = new luceneFileIndex(); idx.open("/path/to/index"); idx.addFile("/path/to/doc.txt"); idx.commit(); results = idx.search("keyword"); idx.close();
luceneFileIndex ()
Default constructor.
open (string Path, bool Reset = false)
Opens or creates a Lucene index at the specified directory path. If the directory already contains an index it is opened for appending, unless Reset is true in which case a fresh index is always created.
Path is a string with the file system directory path for the index.Reset is an optional bool; when true the index is recreated from scratch (default false).This object.getIndexPath ()
Returns the file system path of this index.
A string with the index directory path.addFile (string Path)
Adds a file to the index, auto-detecting its type by extension. Files ending in .md are treated as Markdown; all others as plain text.
Path is a string with the path to the file to add.This object.addTextFile (string Path)
Adds a plain text file to the index.
Path is a string with the path to the text file.This object.addMarkdownFile (string Path)
Adds a Markdown file to the index. Markdown syntax is stripped before the content is indexed.
Path is a string with the path to the Markdown file.This object.commit ()
Commits pending writes and refreshes the internal reader and searcher. This must be called after adding files and before searching.
This object.search (string Query, int MaxResults = 10)
Searches the index using a keyword query string. Returns a list of result maps, each containing the keys: 'path' (string), 'score' (double), 'snippet' (string), and '_docId' (int). The '_docId' field is the internal cursor used by searchAfter() for pagination. commit() must be called before searching.
Query is a string with the Lucene query expression.MaxResults is an optional int with the maximum number of results to return (default 10).A list of result maps with path, score, snippet, and _docId keys.searchAfter (map LastResult, string Query, int MaxResults = 10)
Fetches the next page of results after the given cursor result. Pass the last result map from a previous search() or searchAfter() call. The result maps contain a '_docId' field used internally as the page cursor. commit() must not be called between pages as it invalidates the cursor.
LastResult is a map (the last result map from the previous page).Query is a string with the Lucene query expression (must match the original search).MaxResults is an optional int with the maximum number of results per page (default 10).A list of result maps with path, score, snippet, and _docId keys, or an empty list if no more results.close ()
Closes the index and releases all resources. The index cannot be used after this call.
Null.getDocCount ()
Returns the number of documents currently in the index, including documents that have been added but not yet committed.
An int with the document count.[26:14] (extern: com.lehman.aussomserver.connectors.AussomLuceneIndex) extends: object
Base class for Lucene indexes. Provides shared indexing and searching functionality inherited by luceneFileIndex and luceneMemoryIndex. Do not instantiate this class directly. Use luceneFileIndex for a persistent file-system index or luceneMemoryIndex for an in-memory index.
luceneIndex ()
Default constructor.
addFile (string Path)
Adds a file to the index, auto-detecting its type by extension. Files ending in .md are treated as Markdown; all others as plain text.
Path is a string with the path to the file to add.This object.addTextFile (string Path)
Adds a plain text file to the index.
Path is a string with the path to the text file.This object.addMarkdownFile (string Path)
Adds a Markdown file to the index. Markdown syntax is stripped before the content is indexed.
Path is a string with the path to the Markdown file.This object.commit ()
Commits pending writes and refreshes the internal reader and searcher. This must be called after adding files and before searching.
This object.search (string Query, int MaxResults = 10)
Searches the index using a keyword query string. Returns a list of result maps, each containing the keys: 'path' (string), 'score' (double), 'snippet' (string), and '_docId' (int). The '_docId' field is the internal cursor used by searchAfter() for pagination. commit() must be called before searching.
Query is a string with the Lucene query expression.MaxResults is an optional int with the maximum number of results to return (default 10).A list of result maps with path, score, snippet, and _docId keys.searchAfter (map LastResult, string Query, int MaxResults = 10)
Fetches the next page of results after the given cursor result. Pass the last result map from a previous search() or searchAfter() call. The result maps contain a '_docId' field used internally as the page cursor. commit() must not be called between pages as it invalidates the cursor.
LastResult is a map (the last result map from the previous page).Query is a string with the Lucene query expression (must match the original search).MaxResults is an optional int with the maximum number of results per page (default 10).A list of result maps with path, score, snippet, and _docId keys, or an empty list if no more results.close ()
Closes the index and releases all resources. The index cannot be used after this call.
Null.getDocCount ()
Returns the number of documents currently in the index, including documents that have been added but not yet committed.
An int with the document count.[219:14] (extern: com.lehman.aussomserver.connectors.AussomLuceneMemoryIndex) extends: object
An in-memory Lucene index backed by a ByteBuffersDirectory. Data is ephemeral and is lost when the index is closed. This is ideal for fast, temporary indexing and searching within a single session. Example: idx = new luceneMemoryIndex(); idx.create(); idx.addFile("/path/to/doc.md"); idx.commit(); results = idx.search("keyword"); idx.close();
luceneMemoryIndex ()
Default constructor.
create ()
Creates a new in-memory Lucene index. Call this before adding files.
This object.addFile (string Path)
Adds a file to the index, auto-detecting its type by extension. Files ending in .md are treated as Markdown; all others as plain text.
Path is a string with the path to the file to add.This object.addTextFile (string Path)
Adds a plain text file to the index.
Path is a string with the path to the text file.This object.addMarkdownFile (string Path)
Adds a Markdown file to the index. Markdown syntax is stripped before the content is indexed.
Path is a string with the path to the Markdown file.This object.commit ()
Commits pending writes and refreshes the internal reader and searcher. This must be called after adding files and before searching.
This object.search (string Query, int MaxResults = 10)
Searches the index using a keyword query string. Returns a list of result maps, each containing the keys: 'path' (string), 'score' (double), 'snippet' (string), and '_docId' (int). The '_docId' field is the internal cursor used by searchAfter() for pagination. commit() must be called before searching.
Query is a string with the Lucene query expression.MaxResults is an optional int with the maximum number of results to return (default 10).A list of result maps with path, score, snippet, and _docId keys.searchAfter (map LastResult, string Query, int MaxResults = 10)
Fetches the next page of results after the given cursor result. Pass the last result map from a previous search() or searchAfter() call. The result maps contain a '_docId' field used internally as the page cursor. commit() must not be called between pages as it invalidates the cursor.
LastResult is a map (the last result map from the previous page).Query is a string with the Lucene query expression (must match the original search).MaxResults is an optional int with the maximum number of results per page (default 10).A list of result maps with path, score, snippet, and _docId keys, or an empty list if no more results.close ()
Closes the index and releases all resources. The index cannot be used after this call.
Null.getDocCount ()
Returns the number of documents currently in the index, including documents that have been added but not yet committed.
An int with the document count.