mirror of
https://github.com/SamyRai/tercul-backend.git
synced 2025-12-27 02:51:34 +00:00
- Add Bleve client for keyword search functionality - Integrate Bleve service into application builder - Add BleveIndexPath configuration - Update domain mappings for proper indexing - Add comprehensive documentation and tests
28 lines
513 B
Go
28 lines
513 B
Go
package search
|
|
|
|
import (
|
|
"log"
|
|
"tercul/internal/platform/config"
|
|
"tercul/pkg/search/bleve"
|
|
)
|
|
|
|
var BleveClient *bleve.BleveClient
|
|
|
|
func InitBleve() {
|
|
var err error
|
|
BleveClient, err = bleve.NewBleveClient(config.Cfg.BleveIndexPath)
|
|
if err != nil {
|
|
log.Fatalf("Failed to initialize Bleve: %v", err)
|
|
}
|
|
|
|
log.Println("Connected to Bleve successfully.")
|
|
}
|
|
|
|
func CloseBleve() {
|
|
if BleveClient != nil {
|
|
if err := BleveClient.Close(); err != nil {
|
|
log.Printf("Error closing Bleve client: %v", err)
|
|
}
|
|
}
|
|
}
|