Skip to content

Commit

Permalink
search-api: Remove unnecessary logic to filter copyright in editorial…
Browse files Browse the repository at this point in the history
… search
  • Loading branch information
jnatten committed Jan 14, 2025
1 parent c455226 commit 9603b5e
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import no.ndla.common.model.domain.{Content, Priority}
import no.ndla.common.model.domain.draft.DraftStatus
import no.ndla.language.Language.AllLanguages
import no.ndla.language.model.Iso639
import no.ndla.mapping.License
import no.ndla.search.AggregationBuilder.{buildTermsAggregation, getAggregationsFromResult}
import no.ndla.search.Elastic4sClient
import no.ndla.searchapi.Props
Expand Down Expand Up @@ -269,9 +268,8 @@ trait MultiDraftSearchService {
val idFilter = if (settings.withIdIn.isEmpty) None else Some(idsQuery(settings.withIdIn))

val licenseFilter = settings.license match {
case Some("all") | None => None
case Some("-copyrighted") => Some(boolQuery().not(termQuery("license", License.Copyrighted.toString)))
case Some(lic) => Some(termQuery("license", lic))
case Some("all") | None => None
case Some(lic) => Some(termQuery("license", lic))
}

val grepCodesFilter =
Expand Down
2 changes: 0 additions & 2 deletions search-api/src/test/scala/no/ndla/searchapi/TestData.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1718,8 +1718,6 @@ object TestData {
resultTypes = None
)

val noCopyrightedSettings = multiDraftSearchSettings.copy(license = Some("-copyrighted"))

val searchableResourceTypes: List[SearchableTaxonomyResourceType] = List(
SearchableTaxonomyResourceType(
"urn:resourcetype:subjectMaterial",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,10 +207,10 @@ class MultiDraftSearchServiceTest extends IntegrationSuite(EnableElasticsearchCo
test("That search matches updatedBy") {
val Success(results) =
multiDraftSearchService.matchingQuery(
noCopyrightedSettings.copy(sort = Sort.ByIdAsc, userFilter = List("ndalId54321"))
multiDraftSearchSettings.copy(sort = Sort.ByIdAsc, userFilter = List("ndalId54321"))
)
val hits = results.results
results.totalCount should be(12)
results.totalCount should be(13)
hits.head.id should be(1)
hits.head.contexts.head.contextType should be("standard")
hits(1).id should be(2)
Expand Down

0 comments on commit 9603b5e

Please sign in to comment.