-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
95d3509
commit 61db73f
Showing
3 changed files
with
57 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package collection_read | ||
|
||
import ( | ||
"context" | ||
|
||
"go.uber.org/fx" | ||
"go.uber.org/zap" | ||
|
||
"github.com/Southclaws/fault" | ||
"github.com/Southclaws/fault/fctx" | ||
"github.com/Southclaws/storyden/app/resources/collection" | ||
"github.com/Southclaws/storyden/app/services/semdex" | ||
) | ||
|
||
type CollectionReader struct { | ||
fx.In | ||
|
||
Logger *zap.Logger | ||
Repo collection.Repository | ||
Semdex semdex.Retriever | ||
} | ||
|
||
func (r *CollectionReader) IndexCollection(ctx context.Context, id collection.CollectionID) (*collection.Collection, error) { | ||
col, err := r.Repo.Get(ctx, id) | ||
if err != nil { | ||
return nil, fault.Wrap(err, fctx.With(ctx)) | ||
} | ||
|
||
// ids := dt.Map(col.Items, func(i *collection.CollectionItem) xid.ID { return i.Item.GetID() }) | ||
|
||
// vector, err := r.Semdex.GetVectorFor(ctx, ids...) | ||
// if err != nil { | ||
// r.Logger.Warn("failed to get vector for collection items", zap.Error(err)) | ||
// } | ||
|
||
// TODO: dispatch indexing request for this vector | ||
|
||
return col, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package weaviate | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/rs/xid" | ||
) | ||
|
||
func (s *weaviateSemdexer) GetVectorFor(ctx context.Context, idx ...xid.ID) ([]float64, error) { | ||
// TODO: pull vectors for all items, compute average and return? | ||
return nil, nil | ||
} |