@@ -15,8 +15,6 @@ import (
1515 "strconv"
1616 "time"
1717
18- "github.com/muesli/cache2go"
19-
2018 "github.com/front-matter/commonmeta/authorutils"
2119 "github.com/front-matter/commonmeta/commonmeta"
2220 "github.com/front-matter/commonmeta/doiutils"
@@ -784,17 +782,10 @@ func SearchByDOI(doi string, client *InvenioRDMClient) (string, error) {
784782}
785783
786784// SearchBySlug searches InvenioRDM communities by slug.
787- // Specify type of community (blog, topic or subject) in query, subject area communities are always queried.
788- func SearchBySlug (slug string , type_ string , client * InvenioRDMClient , cache * cache2go.CacheTable ) (string , error ) {
789- // first check for cached community ID
790- res , _ := cache .Value (slug )
791- if res != nil {
792- id := fmt .Sprintf ("%v" , res .Data ())
793- return id , nil
794- }
795-
785+ // Specify type of community (blog, topic or subject) in query.
786+ func SearchBySlug (slug string , type_ string , client * InvenioRDMClient ) (string , error ) {
796787 var query Query
797- requestURL := fmt .Sprintf ("https://%s/api/communities?q=slug:%s&type=%s&type=subject " , client .Host , slug , type_ )
788+ requestURL := fmt .Sprintf ("https://%s/api/communities?q=slug:%s&type=%s" , client .Host , slug , type_ )
798789 req , _ := http .NewRequest (http .MethodGet , requestURL , nil )
799790 req .Header = http.Header {
800791 "Content-Type" : {"application/json" },
@@ -814,7 +805,6 @@ func SearchBySlug(slug string, type_ string, client *InvenioRDMClient, cache *ca
814805 return "" , nil
815806 } else {
816807 id := utils .ParseString (query .Hits .Hits [0 ].ID )
817- cache .Add (slug , 1 * time .Hour , id )
818808 return id , nil
819809 }
820810}
0 commit comments