Use the event.id as identifier in typesense

This commit is contained in:
@s.roertgen 2025-03-28 15:08:09 +01:00
parent 47b5e2fb56
commit 36952a5ffe
2 changed files with 3 additions and 5 deletions

View file

@ -243,7 +243,7 @@ func NostrToAMB(event *nostr.Event) (*AMBMetadata, error) {
switch tag[0] {
case "d":
if len(tag) >= 2 {
amb.ID = tag[1]
amb.ID = event.ID
amb.D = tag[1]
}
case "name":

View file

@ -14,6 +14,8 @@ import (
"github.com/nbd-wtf/go-nostr"
)
// TODO fix all the request stuff and put it in a dedicated function
type CollectionSchema struct {
Name string `json:"name"`
Fields []Field `json:"fields"`
@ -234,10 +236,6 @@ func IndexNostrEvent(collectionName string, event *nostr.Event) error {
}
func eventAlreadyIndexed(collectionName string, doc *AMBMetadata) (*nostr.Event, error) {
// TODO das muss eine Query nach d-tag und hexkey werden
// als Ergebnis kommt dann die eventID zurück
// wenn es eine Event ID gibt, wird die zuerst bei indexDocument gelöscht und dann die neue angelegt
// function für query event by d-tag and hex key
url := fmt.Sprintf(
"%s/collections/%s/documents/search?filter_by=d:=%s&&eventPubKey:=%s&q=&query_by=d,eventPubKey",
typesenseHost, collectionName, doc.D, doc.EventPubKey)