Changelog
February 22, 2026 · View on GitHub
All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
[v1.3.0]
Changed
- Go version updated to 1.26
- MongoDB driver updated to v2
- All module dependencies updated
[v1.2.0]
Enhanced
- Improved ObjectID Detection - Now detects any field ending with
_id(not just_iditself) - Smart ObjectID Conversion - Only attempts conversion for 24-character hex strings matching
^[0-9a-fA-F]{24}$ - Graceful Fallback - Falls back to string search instead of erroring when ObjectID conversion fails
- Removed Strict Validation - ID fields now support all query patterns (regex, wildcards, ranges, comparisons)
Changed
- ID Field Detection -
isIDField()now matches any field ending with_id(e.g.,user_id,order_id,product_id) - ObjectID Conversion -
convertToObjectID()now validates hex pattern before attempting conversion - Error Handling - Removed strict validation errors; ID fields now gracefully fallback to string behavior
- Field Value Processing -
fieldValueToBSONWithContext()no longer errors on invalid ObjectIDs
Features Implemented
user_id:507f1f77bcf86cd799439011- Converts to{"user_id": ObjectID("507f1f77bcf86cd799439011")}order_id:invalid- Falls back to{"order_id": "invalid"}(string search)id:/pattern/- Falls back to{"_id": {"$regex": "^pattern$"}}(regex search)id:*pattern*- Falls back to wildcard pattern (wildcard search)id:[start TO end]- Falls back to range pattern (range search)id:>value- Falls back to comparison pattern (comparison search)
Technical Improvements
- Enhanced
isIDField()method to detect any*_idfield - Removed
validateIDFieldValue()method entirely - Updated
convertToObjectID()with regex validation and graceful fallback - Modified
fieldValueToBSONWithContext()to handle fallback scenarios - Updated all test cases to reflect new behavior
Documentation
- Updated README.md with new ID field detection behavior
- Added examples of
*_idfield detection and fallback scenarios - Documented removal of strict validation restrictions
- Updated configuration documentation
Testing
- Updated unit tests to expect success instead of errors for ID field patterns
- Added test cases for
*_idfields (user_id,order_id,product_id) - Updated integration tests to verify fallback behavior
- Added comprehensive test coverage for new detection logic
[v1.1.0]
Added
- ID field conversion - Automatic conversion of
idfield names to_idfor MongoDB compatibility - ObjectID support - Automatic conversion of string values to
primitive.ObjectIDfor_idfields - Nested ID field conversion - Support for nested ID fields (e.g.,
user.id→user._id) - ID field validation - Strict validation for
_idfields with clear error messages - Configuration options for ID field handling:
WithReplaceIDWithMongoID(bool)- Enable/disableidto_idconversion (default:true)WithAutoConvertIDToObjectID(bool)- Enable/disable ObjectID conversion (default:true)
Features Implemented
id:507f1f77bcf86cd799439011- Converts to{"_id": ObjectID("507f1f77bcf86cd799439011")}user.id:507f1f77bcf86cd799439011- Converts to{"user._id": ObjectID("507f1f77bcf86cd799439011")}id:invalid-hex- Returns validation error for invalid ObjectID hex stringsid:/pattern/- Returns error for unsupported regex patterns on_idfieldsid:*pattern*- Returns error for unsupported wildcard patterns on_idfieldsid:[start TO end]- Returns error for unsupported range queries on_idfieldsid:>value- Returns error for unsupported comparison operators on_idfields
Technical Improvements
- Enhanced
MongoFormatterwith ID field conversion logic - Added
convertFieldName()method for field name transformation - Added
isIDField()method for ID field detection - Added
validateIDFieldValue()method for strict validation - Added
convertToObjectID()method for ObjectID conversion - Updated error handling to propagate validation errors through the parsing pipeline
- Added comprehensive test coverage for all ID field conversion scenarios
Documentation
- Updated README.md with ID field conversion examples and configuration
- Added new "ID Field Conversion" section with usage examples
- Documented configuration options and restrictions
- Updated feature list to include ID field conversion
Testing
- Added unit tests for ID field conversion in
formatter/mongo/formatter_test.go - Added integration tests in
tests/lucene-mongo/unit_test.go - Added MongoDB integration tests in
tests/lucene-mongo/integration_test.go - All tests consolidated into existing test functions for better organization
- Comprehensive error case testing for invalid ObjectID and unsupported patterns
[v0.10.0-beta.1]
Fixed
- NOT operator with wildcards and regex - Fixed bug where NOT expressions with wildcards (e.g.,
NOT name:jo*) or regex patterns (e.g.,NOT name:/^john.*/) were using$neoperator instead of$not. MongoDB's$neoperator cannot wrap query operators like$regex,$gt,$lt, etc. The fix now correctly uses$notfor query operators and$nefor simple values.
[v0.9.0-beta.1]
Changed
- BREAKING: Regex patterns now anchored by default - All regex queries (
field:/pattern/) automatically add^and$anchors for exact matching, consistent with Lucene behavior - BREAKING: Multiple unquoted words use OR logic - Free text queries with multiple words (e.g.,
john doe) now search each word separately with OR, rather than as a single phrase, consistent with Lucene behavior - BREAKING: Mixed queries default to OR - Field:value followed by free text without explicit operators (e.g.,
name:john admin) now uses OR instead of AND - Case sensitivity - Free text searches are case-insensitive with
$options: "i", while regex patterns and wildcard patterns are case-sensitive
Migration
Update queries to reflect new behavior:
// Regex - for partial matches, use wildcards explicitly
"name:/john/" // Before: partial match, After: exact match "^john$"
"name:/.*john.*/" // Use this for partial matches
// Multiple words - use quotes for exact phrases
"john doe" // Before: phrase match, After: john OR doe
"\"john doe\"" // Use quotes for exact phrase matching
// Mixed queries - use explicit AND for AND behavior
"name:john admin" // Before: AND, After: OR
"name:john AND admin" // Use explicit AND operator
[v0.8.0-beta.1]
Added
- Default fields support for free text queries without requiring text indexes
ParseWithDefaults()function for specifying default fields per queryWithDefaultFields()config method for parser-level default field configuration- Wildcard and regex support in default field queries
Removed
- MongoDB text search support - Removed
$textoperator functionality, replaced with default field searches for better Lucene compatibility and performance WithEnableTextSearch()config method
Changed
- Free text queries with default fields use case-insensitive regex by default
- ParseWithDefaults takes priority over config-level default fields
[v0.7.0-beta.1]
Changed
- BREAKING: Renamed BSON formatter to MongoDB formatter (
config.FormatterBSON→config.FormatterMongo) - Moved formatter from
formatter/bson/toformatter/mongo/for better clarity
Added
- Enhanced developer documentation with architecture overview
- Reorganized test structure with language-formatter specific test directories
Migration
Update your code to use the new formatter name:
// Old
cfg := config.Default().WithFormatter(config.FormatterBSON)
// New
cfg := config.Default().WithFormatter(config.FormatterMongo)
[v0.6.0-beta.1]
Added
- Regex pattern support with Lucene-style syntax
field:/regex/ - MongoDB regex output with case-sensitive matching (like Lucene default)
- Regex with logical operators for complex query combinations
Features Implemented
name:/john/- Basic regex patternsemail:/.*@example\\.com/- Complex regex with escaped charactersphone:/\\d{3}-\\d{3}-\\d{4}/- Regex with digit matchingstatus:/^(active|pending|inactive)$/- Regex with alternationname:/john/ OR email:/.*@example\\.com/- Regex with logical operators
Technical Improvements
- Added
Regexfield toParticipleValuestruct for regex pattern recognition - Enhanced lexer with regex token pattern
/([^/\\]|\\.)*/ - Added
tryParseRegex()andparseRegex()methods to formatter - Reordered parser priority to check regex before wildcard patterns
- Added comprehensive test coverage for regex functionality
Documentation
- Updated README with regex examples and improved readability
- Streamlined documentation structure and removed redundancy
- Added regex feature to features list and query syntax sections
[v0.5.0-beta.1]
Added
- Participle integration for robust parsing and grammar handling
- Developer documentation with comprehensive architecture overview
Changed
- Refactored parsing engine to use Participle for lexical analysis and AST generation
- Improved error handling with better syntax error messages from Participle
Technical Improvements
- Migrated from custom lexer to Participle lexer for better token recognition
- Implemented proper grammar hierarchy with Participle struct tags
- Added comprehensive AST to BSON conversion pipeline
- Maintained backward compatibility with existing API
Documentation
- Added
DEVELOPER_README.mdwith detailed technical documentation - Documented Participle integration patterns and custom implementation details
- Added visual flow diagrams and code distribution breakdown
[v0.4.0-beta.1]
Added
- Number range queries with Lucene-style syntax
- Numeric comparison operators (
>,<,>=,<=) - Range syntax with
[start TO end]for numeric fields - Wildcard support in number ranges (
[* TO end],[start TO *]) - Decimal number support for price ranges and precise numeric queries
- Complex number queries combining ranges with logical operators
Features Implemented
age:[18 TO 65]- Number range queries using$gteand$lteprice:[10.50 TO 99.99]- Decimal number rangesscore:>85- Greater than comparisons using$gtscore:<60- Less than comparisons using$ltscore:>=90- Greater than or equal using$gtescore:<=50- Less than or equal using$lteage:[18 TO *]- Open-ended ranges with wildcardsage:[* TO 65]- Lower-bound ranges with wildcardsage:[18 TO 65] AND status:active- Number ranges with field conditionsage:>18 OR score:<60- Multiple numeric comparisons with ORprice:[0 TO 100] OR rating:[4 TO 5]- Multiple number ranges with OR
API Changes
- Enhanced
parseValue()method to detect and parse number ranges - Added
isNumberRange()andisNumberComparison()detection methods - Added
parseNumberRange()andparseNumberComparison()parsing methods - Improved date detection to distinguish between date and number ranges
- Enhanced type detection for better numeric vs date parsing
Documentation
- Updated README.md with comprehensive number range examples
- Added number range features to feature list
- Updated integration tests with real MongoDB number range queries
- Enhanced examples with number range demonstrations
Testing
- Added comprehensive unit tests for number range functionality
- Added integration tests for invalid number query handling
- All existing tests continue to pass (no regressions)
[v0.3.0-beta.1]
Added
- Full-text search support with MongoDB
$textoperator - Configurable search modes (
SearchModeDisabled,SearchModeText) - Mixed queries combining text search with field searches
- Text search examples in documentation
- MongoDB text index requirements documentation
Features Implemented
engineer software- Pure text search using$textoperatorengineer name:john- Mixed queries combining text and field searchsoftware engineer role:admin- Multiple text terms with field filteringdesigner role:user AND active:true- Text search with complex field queriesdevops role:admin OR name:charlie- Text search with OR field queriesengineer (role:admin AND age:25)- Text search with grouped field conditions
API Changes
- Added
NewWithTextSearch()constructor for text search enabled parser - Added
SetSearchMode(mode SearchMode)method for runtime configuration - Added
SearchModeenum withSearchModeDisabledandSearchModeTextoptions - Made
HandleTextSearchNode()public for advanced usage
Documentation
- Updated README with text search examples and configuration
- Added MongoDB text index setup instructions
- Added mixed query usage examples
- Enhanced API documentation with search mode examples
Technical Improvements
- Refactored query parsing logic for better separation of concerns
- Improved cyclomatic complexity through helper methods and structs
- Enhanced tokenization for mixed query support
- Added comprehensive unit tests for text search functionality
- Improved error messages and validation
[v0.2.0-beta.1]
Added
- Initial implementation of Lucene-style syntax parser
- Basic field matching (exact matches and wildcards)
- Support for dot notation for nested fields
- AND operator support
- OR operator support
- NOT operator support
- Complex operator combinations (OR with AND and NOT)
- Parentheses support for query grouping and precedence control
- Quoted string value support
- Comprehensive test suite
- Example usage code
- Makefile for development tasks
Features Implemented
name:john- Exact field matchingname:jo*- Wildcard matching with regexname:"john doe"- Quoted string valuesname:john AND age:25- AND operatorname:john OR name:jane- OR operatorname:john AND NOT age:25- NOT operatorNOT status:inactive- NOT operator at beginningname:jo* OR name:ja* AND NOT age:18- Complex combinations(name:john OR name:jane) AND age:25- Parentheses groupingNOT (name:john OR name:jane)- NOT with grouped expressions((name:john OR name:jane) AND age:25) OR status:active- Nested parenthesesuser.profile.email:john@example.com- Dot notation for nested fields
Planned Features
- Array search optimization
- Range queries (age:[18 TO 65])
- Fuzzy search
- Custom field mappings
- Query validation
- Performance optimizations