mirror of
https://github.com/SamyRai/tercul-backend.git
synced 2025-12-27 04:01:34 +00:00
- Merged main branch improvements (better search structure with SearchResultItem) - Added SearchAlpha config parameter for hybrid search tuning (default: 0.7) - Updated NewWeaviateWrapper to accept host and searchAlpha parameters - Fixed all type mismatches in mocks and tests - Updated GraphQL resolver to use new SearchResults structure - All tests and vet checks passing
27 lines
648 B
Go
27 lines
648 B
Go
package search
|
|
|
|
import (
|
|
"context"
|
|
"tercul/internal/domain"
|
|
domainsearch "tercul/internal/domain/search"
|
|
|
|
"github.com/stretchr/testify/mock"
|
|
)
|
|
|
|
type MockWeaviateWrapper struct {
|
|
mock.Mock
|
|
}
|
|
|
|
func (m *MockWeaviateWrapper) Search(ctx context.Context, params domainsearch.SearchParams) (*domainsearch.SearchResults, error) {
|
|
args := m.Called(ctx, params)
|
|
if args.Get(0) == nil {
|
|
return nil, args.Error(1)
|
|
}
|
|
return args.Get(0).(*domainsearch.SearchResults), args.Error(1)
|
|
}
|
|
|
|
func (m *MockWeaviateWrapper) IndexWork(ctx context.Context, work *domain.Work, content string) error {
|
|
args := m.Called(ctx, work, content)
|
|
return args.Error(0)
|
|
}
|