From b66621b283db16e59fd02b2c694d88993086ecef Mon Sep 17 00:00:00 2001 From: Chris Lawrence Date: Mon, 11 Nov 2024 01:16:01 +0000 Subject: [PATCH] Tag query change --- paperless.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/paperless.go b/paperless.go index 18ccf52..f03ae59 100644 --- a/paperless.go +++ b/paperless.go @@ -108,10 +108,11 @@ func (c *PaperlessClient) GetAllTags(ctx context.Context) (map[string]int, error func (c *PaperlessClient) GetDocumentsByTags(ctx context.Context, tags []string) ([]Document, error) { tagQueries := make([]string, len(tags)) for i, tag := range tags { - tagQueries[i] = fmt.Sprintf("tag:%s", tag) + tagQueries[i] = fmt.Sprintf("tags__name__iexact=%s", tag) } - searchQuery := strings.Join(tagQueries, " ") - path := fmt.Sprintf("api/documents/?query=%s", urlEncode(searchQuery)) + searchQuery := strings.Join(tagQueries, "&") + path := fmt.Sprintf("api/documents/?%s", urlEncode(searchQuery)) + log.Printf("Get URL: %s", path) resp, err := c.Do(ctx, "GET", path, nil) if err != nil {