Skip to content

Commit

Permalink
Priority is optional in search. Fix tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
katrinewi committed Nov 10, 2023
1 parent 12d5493 commit 9d642f0
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,6 @@ case class MultiSearchSummary(
@(ApiModelProperty @field)(description = "A list of revisions planned for the article") revisions: Seq[RevisionMeta],
@(ApiModelProperty @field)(description = "Responsible field") responsible: Option[DraftResponsible],
@(ApiModelProperty @field)(description = "Information about comments attached to the article") comments: Option[Seq[Comment]],
@(ApiModelProperty @field)(description ="If the article should be prioritized" ) priority: Priority
@(ApiModelProperty @field)(description ="If the article should be prioritized" ) priority: Option[Priority]
)
// format: on
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@ trait SearchConverterService {
revisions = Seq.empty,
responsible = None,
comments = None,
priority = Priority.Unspecified
priority = Some(Priority.Unspecified)
)
}

Expand Down Expand Up @@ -544,7 +544,7 @@ trait SearchConverterService {
revisions = revisions,
responsible = responsible,
comments = Some(comments),
priority = searchableDraft.priority
priority = Some(searchableDraft.priority)
)
}

Expand Down Expand Up @@ -595,7 +595,7 @@ trait SearchConverterService {
revisions = Seq.empty,
responsible = None,
comments = None,
priority = Priority.Unspecified
priority = Some(Priority.Unspecified)
)
}

Expand Down
18 changes: 16 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 @@ -8,7 +8,21 @@
package no.ndla.searchapi

import no.ndla.common.configuration.Constants.EmbedTagName
import no.ndla.common.model.domain.{ArticleContent, ArticleMetaImage, ArticleType, Author, Availability, EditorNote, Introduction, Priority, Status, Tag, Title, VisualElement, draft}
import no.ndla.common.model.domain.{
ArticleContent,
ArticleMetaImage,
ArticleType,
Author,
Availability,
EditorNote,
Introduction,
Priority,
Status,
Tag,
Title,
VisualElement,
draft
}
import no.ndla.common.model.domain.article.{Article, Copyright}
import no.ndla.common.model.domain.draft.{Draft, DraftCopyright, DraftStatus}
import no.ndla.common.model.domain.learningpath.LearningpathCopyright
Expand Down Expand Up @@ -1596,7 +1610,7 @@ object TestData {
responsibleIdFilter = List.empty,
articleTypes = List.empty,
filterInactive = false,
priority = Priority.Unspecified,
priority = List.empty
)

val searchableResourceTypes: List[SearchableTaxonomyResourceType] = List(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -797,7 +797,7 @@ class MultiDraftSearchServiceAtomicTest
id = Some(4)
)
val draft5 = TestData.draft1.copy(
id = Some(4),
id = Some(5),
priority = Priority.OnHold
)
draftIndexService.indexDocument(draft1, Some(taxonomyTestBundle), Some(grepBundle)).get
Expand Down Expand Up @@ -836,6 +836,16 @@ class MultiDraftSearchServiceAtomicTest
.get
.results
.map(_.id) should be(Seq(5))

multiDraftSearchService
.matchingQuery(
multiDraftSearchSettings.copy(
priority = List.empty
)
)
.get
.results
.map(_.id) should be(Seq(1, 2, 3, 4, 5))
}

test("That search on embed id supports video embed with timestamp resources") {
Expand Down

0 comments on commit 9d642f0

Please sign in to comment.