AI search engine and MCP server for bots and agents. One Rust binary indexes code, docs, logs, JSONL/CSV and PDFs for BM25 full-text, vector and hybrid search, code search without grep, agent memory and RAG. Elasticsearch-compatible API; Corpus Hub serves hundreds of reference memory corpora.
Rust agent-memoryai-agentsbm25claude-codeclicode-searchcursordatabaseelasticsearchfull-text-searchhybrid-searchjsonllocal-firstmcpmcp-servermodel-context-protocolragrustsearch-enginevector-search
fix(autoindex): index Dart extension and extension type declarations (#2865)
Chandra ObulaReddyf50aae9101dd
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex f6824f485..04f7358db 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -111,6 +111,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0### Fixed+- `xerj autoindex` now records Dart `extension` and `extension type`+ declarations as `class` definitions, so `xerj def <ExtensionName>` finds+ them. Methods inside an extension were already indexed; the extension's own+ name was not, because the Dart query adapted from tree-sitter-dart's+ `tags.scm` had dropped both forms.+- The field-report HTTP fallback now enforces its 16 KiB body limit on rawbytes before decoding or storage access. Multibyte JSON without a reliable`Content-Length` no longer bypasses the limit by having fewer characters.diff --git a/engine/crates/xerj-autoindex/src/extract/code.rs b/engine/crates/xerj-autoindex/src/extract/code.rsindex 9789efb3e..09f3f6fd1 100644--- a/engine/crates/xerj-autoindex/src/extract/code.rs+++ b/engine/crates/xerj-autoindex/src/extract/code.rs@@ -2235,12 +2235,16 @@ const SCALA_Q: &str = r#"(object_definition body: (template_body (val_definition pattern: (identifier) @const)))"#;-// Adapted from tree-sitter-dart 0.2.0 queries/tags.scm (class / mixin / enum-// / function / method / typedef / enum-constant captures; getter/setter and-// constructor variants dropped as weight without retrieval surface).+// Adapted from tree-sitter-dart 0.2.0 queries/tags.scm (class / mixin /+// extension / extension type / enum / function / method / typedef /+// enum-constant captures; getter/setter and constructor variants dropped as+// weight without retrieval surface). tags.scm tags both extension forms as+// `definition.class`, and Swift's `extension` above is `@class` too.const DART_Q: &str = r#"(class_declaration name: (identifier) @class)(mixin_declaration (identifier) @mixin)+(extension_declaration name: (identifier) @class)+(extension_type_declaration name: (extension_type_name (identifier) @class))(enum_declaration name: (identifier) @enum)(enum_constant name: (identifier) @const)(function_signature name: (identifier) @function)@@ -4556,7 +4560,9 @@ export { type specTypeOnly as Alias, valueStore };mixin Musical { void play() {} }\n\enum Suit { hearts, spades }\n\typedef Handler = void Function(int);\n\- int topLevel(int x) { return x; }\n",+ int topLevel(int x) { return x; }\n\+ extension Shout on String { String shout() => toUpperCase(); }\n\+ extension type UserId(int value) { bool get isValid => value > 0; }\n",);assert!(has(&s, "Greeter", "class"), "got {s:?}");assert!(has(&s, "Musical", "mixin"), "got {s:?}");@@ -4565,6 +4571,9 @@ export { type specTypeOnly as Alias, valueStore };assert!(has(&s, "Handler", "type"), "got {s:?}");assert!(has(&s, "topLevel", "function"), "got {s:?}");assert!(has(&s, "greet", "function"), "got {s:?}");+ assert!(has(&s, "Shout", "class"), "got {s:?}");+ assert!(has(&s, "UserId", "class"), "got {s:?}");+ assert!(has(&s, "shout", "function"), "got {s:?}");}#[test]