Enhance Notice Repository with Additional Indexes

- Added new indexes for the notices collection in the notice repository to improve query performance.
- Introduced indexes for `processing_metadata.processed` and `main_classification`, optimizing data retrieval and management.
This commit is contained in:
Nima Nakhostin
2025-11-30 12:43:51 +03:30
parent d57bf95c70
commit 00fabe8a30
+5 -1
View File
@@ -34,7 +34,11 @@ type noticeRepository struct {
// NewRepository creates a new notice repository
func NewRepository(mongoManager *orm.ConnectionManager, logger logger.Logger) Repository {
// Create indexes for notices collection
noticeIndexes := []orm.Index{}
noticeIndexes := []orm.Index{
// processing_metadata.processed
*orm.NewIndex("processing_metadata_processed_idx", bson.D{{Key: "processing_metadata.processed", Value: 1}}),
*orm.NewIndex("main_classification_idx", bson.D{{Key: "main_classification", Value: 1}}),
}
// Create indexes
if err := mongoManager.CreateIndexes(collectionName(), noticeIndexes); err != nil {