Skip to content

Commit 40ca221

Browse files
committed
Revert "CMR-7230 Updating community usage metrics to also include Persistent ID attribute as identifier (#1208)"
This reverts commit d1f858a. CMR-7230 was marked "Verify Failed" and is being re-worked.
1 parent c945fa1 commit 40ca221

File tree

2 files changed

+8
-51
lines changed

2 files changed

+8
-51
lines changed

search-app/src/cmr/search/services/community_usage_metrics/metrics_service.clj

+2-8
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
[cmr.common.log :as log :refer (debug info warn error)]
1313
[cmr.common.services.errors :as errors]
1414
[cmr.common.util :as util]
15-
[cmr.search.models.query :as advanced-query]
1615
[cmr.search.services.community-usage-metrics.metrics-json-schema-validation :as metrics-json]
1716
[cmr.search.services.humanizers.humanizer-service :as humanizer-service]))
1817

@@ -37,7 +36,7 @@
3736

3837
(defn- get-collection-by-product-id
3938
"Query elastic for a collection with a given product-id, parses out the value before the last : and
40-
checks that value against entry-title, short-name, and Persistent ID attribute. Also checks the non-parsed value against
39+
checks that value against both entry-title or short-name. Also checks the non-parsed value against
4140
short-name."
4241
[context product-id]
4342
(when (seq product-id)
@@ -46,12 +45,7 @@
4645
(last matches))]
4746
(let [condition (gc/or (qm/string-condition :entry-title parsed-product-id false false)
4847
(qm/string-condition :short-name parsed-product-id false false)
49-
(qm/string-condition :short-name product-id false false)
50-
;; Handle PODAAC case
51-
(advanced-query/map->AttributeValueCondition
52-
{:name "Persistent ID"
53-
:type :string
54-
:value product-id}))
48+
(qm/string-condition :short-name product-id false false))
5549
query (qm/query {:concept-type :collection
5650
:condition condition
5751
:page-size 1

system-int-test/test/cmr/system_int_test/search/collection_relevancy/collection_usage_relevancy_test.clj

+6-43
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
cmr.system-int-test.search.collection-relevancy.collection-relevancy namespace.
55
For all of the tests in this namespace we bin each integer value to its own bin."
66
(:require
7-
[clojure.string :as string]
7+
[clojure.string :as str]
88
[clojure.test :refer :all]
99
[cmr.access-control.test.util :as u]
1010
[cmr.common.config :as config]
@@ -22,11 +22,11 @@
2222
[cmr.system-int-test.utils.search-util :as search]))
2323

2424
(def sample-usage-csv
25-
(string/join "\n" ["Product,Version,Hosts"
26-
"AMSR-L1A,3,10"
27-
"AG_VIRTUAL,1,100"
28-
"AG_MAPSS,2,30"
29-
"AST_05,B,8"]))
25+
(str "Product,Version,Hosts\n"
26+
"AMSR-L1A,3,10\n"
27+
"AG_VIRTUAL,1,100\n"
28+
"AG_MAPSS,2,30\n"
29+
"AST_05,B,8\n"))
3030

3131
(defn- init-community-usage-fixture
3232
"Sets up the community usage config required for each test."
@@ -234,40 +234,3 @@
234234
(let [results (:refs (search/find-refs :collection {:keyword "AMSR-L1A"}))]
235235
(is (= ["AMSR-L1A 003" "AMSR-L1A 2" "AMSR-L1A 1"]
236236
(map :name results)))))
237-
238-
(deftest sorting-handles-persistent-id-attribute-test
239-
(d/ingest-umm-spec-collection "PROV1"
240-
(data-umm-c/collection {:ShortName "ABOM-AUS-RAMSSA_09km"
241-
:EntryTitle "PODAAC 1"
242-
:AdditionalAttributes
243-
[{:Name "Persistent ID"
244-
:Value "PODAAC-GHRAM-4FA01"
245-
:DataType "STRING"
246-
:Description "Dataset Persistent ID"}]
247-
:Version "1"}))
248-
(d/ingest-umm-spec-collection "PROV1"
249-
(data-umm-c/collection {:ShortName "L4HRfnd-AUS-RAMSSA_09km"
250-
:EntryTitle "PODAAC 2"
251-
:AdditionalAttributes
252-
[{:Name "Persistent ID"
253-
:Value "PODAAC-HHRAD-5FB11"
254-
:DataType "STRING"
255-
:Description "Dataset Persistent ID"}]
256-
:Version "1"}))
257-
258-
(index/wait-until-indexed)
259-
(hu/ingest-community-usage-metrics (str "Product,Version,Hosts\n"
260-
"PODAAC-GHRAM-4FA01,1,10\n"
261-
"PODAAC-HHRAD-5FB11,1,50\n"))
262-
(index/wait-until-indexed)
263-
(are3
264-
[sort-order expected]
265-
(let [results (:refs (search/find-refs :collection {:keyword "PODAAC" :sort-key sort-order}))]
266-
(is (= expected
267-
(map :name results))))
268-
269-
"ascending usage"
270-
"usage-score" ["PODAAC 1" "PODAAC 2"]
271-
272-
"descending usage"
273-
"-usage-score" ["PODAAC 2" "PODAAC 1"]))

0 commit comments

Comments
 (0)