mirror of
https://github.com/edufeed-org/amb-relay.git
synced 2025-12-09 16:24:33 +00:00
Use the event.id as identifier in typesense
This commit is contained in:
parent
47b5e2fb56
commit
36952a5ffe
2 changed files with 3 additions and 5 deletions
|
|
@ -243,7 +243,7 @@ func NostrToAMB(event *nostr.Event) (*AMBMetadata, error) {
|
||||||
switch tag[0] {
|
switch tag[0] {
|
||||||
case "d":
|
case "d":
|
||||||
if len(tag) >= 2 {
|
if len(tag) >= 2 {
|
||||||
amb.ID = tag[1]
|
amb.ID = event.ID
|
||||||
amb.D = tag[1]
|
amb.D = tag[1]
|
||||||
}
|
}
|
||||||
case "name":
|
case "name":
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,8 @@ import (
|
||||||
"github.com/nbd-wtf/go-nostr"
|
"github.com/nbd-wtf/go-nostr"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// TODO fix all the request stuff and put it in a dedicated function
|
||||||
|
|
||||||
type CollectionSchema struct {
|
type CollectionSchema struct {
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
Fields []Field `json:"fields"`
|
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) {
|
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(
|
url := fmt.Sprintf(
|
||||||
"%s/collections/%s/documents/search?filter_by=d:=%s&&eventPubKey:=%s&q=&query_by=d,eventPubKey",
|
"%s/collections/%s/documents/search?filter_by=d:=%s&&eventPubKey:=%s&q=&query_by=d,eventPubKey",
|
||||||
typesenseHost, collectionName, doc.D, doc.EventPubKey)
|
typesenseHost, collectionName, doc.D, doc.EventPubKey)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue