Skip to content

Commit

Permalink
better naming, as per review
Browse files Browse the repository at this point in the history
  • Loading branch information
paul-butcher committed Jul 20, 2023
1 parent 8076c47 commit b3f55a3
Show file tree
Hide file tree
Showing 10 changed files with 16 additions and 16 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package weco.api.search.models

import java.time.LocalDate
sealed trait DocumentFilterBase
sealed trait WorkFilter extends DocumentFilterBase
sealed trait DocumentFilter
sealed trait WorkFilter extends DocumentFilter

sealed trait ImageFilter extends DocumentFilterBase
sealed trait ImageFilter extends DocumentFilter

case class ItemLocationTypeIdFilter(locationTypeIds: Seq[String])
extends WorkFilter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import weco.api.search.models.request.{
WorkAggregationRequest
}

sealed trait SearchOptions[DocumentFilter, AggregationRequest, MustQuery] {
sealed trait SearchOptions[DocFilter, AggregationRequest, MustQuery] {
val searchQuery: Option[SearchQuery]
val filters: List[DocumentFilter]
val filters: List[DocFilter]
val aggregations: List[AggregationRequest]
val mustQueries: List[MustQuery]
val sortBy: List[SortRequest]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import io.circe.Json
import weco.api.search.models.{
AvailabilitiesFilter,
ContributorsFilter,
DocumentFilterBase,
DocumentFilter,
FormatFilter,
GenreFilter,
LanguagesFilter,
Expand Down Expand Up @@ -61,7 +61,7 @@ class FilterBucketMatcher(
}

object FilterBucketMatcher {
def apply(filters: Seq[DocumentFilterBase]) =
def apply(filters: Seq[DocumentFilter]) =
new FilterBucketMatcher(
filters collect {
case FormatFilter(ids) =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ trait AggregatingTestCases extends AnyFunSpec with ApiWorksTestBase {
val redundantFilterParams: String
val redundantFilterBucket: String

val bogusValueParams: String
val unattestedValueParams: String

describe(s"filtering and aggregating on $fieldName") {
it(
Expand All @@ -35,14 +35,14 @@ trait AggregatingTestCases extends AnyFunSpec with ApiWorksTestBase {
}

it(
"does not return an aggregation containing the filtered value if the value is bogus"
"does not return an aggregation containing the filtered value if the value is not attested in the corpus"
) {
withWorksApi {
case (worksIndex, routes) =>
indexTestDocuments(worksIndex, testWorks: _*)
assertJsonResponse(
routes,
path = s"$rootPath/works?$bogusValueParams"
path = s"$rootPath/works?$unattestedValueParams"
) {
Status.OK -> worksListResponseWithAggs(
Nil,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,6 @@ class FilterAndAggregateByAvailabilityTest
| "label" : "Online",
| "type" : "Availability"
| }""".stripMargin
val bogusValueParams: String =
val unattestedValueParams: String =
"availabilities=on-the-moon&genres.label=ThisIsNotAGenre&aggregations=availabilities"
}
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ class FilterAndAggregateByContributorTest
|""".stripMargin

val aggregationName: String = "contributors.agent.label"
val bogusValueParams: String =
val unattestedValueParams: String =
"languages=sjn&contributors.agent.label=Joseph%20Pujol&aggregations=contributors.agent.label"
val bogusValueResponse: String = ""
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,6 @@ class FilterAndAggregateByFormatTest
| "label" : "Pictures",
| "type" : "Format"
| }""".stripMargin
val bogusValueParams: String =
val unattestedValueParams: String =
"workType=z&genres.label=ThisIsNotAGenre&aggregations=workType"
}
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class FilterAndAggregateByGenreTest
| }
|""".stripMargin
val aggregationName: String = "genres.label"
val bogusValueParams: String =
val unattestedValueParams: String =
"languages=sjn&genres.label=NotAGenre&aggregations=genres.label"
val bogusValueResponse: String = ""
}
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class FilterAndAggregateByLanguageTest
| }
|""".stripMargin
val aggregationName: String = "languages"
val bogusValueParams: String =
val unattestedValueParams: String =
"languages=sjn&genres.label=NotAGenre&aggregations=languages"
val bogusValueResponse: String = ""
}
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ class FilterAndAggregateBySubjectTest
| }
|""".stripMargin
val aggregationName: String = "subjects.label"
val bogusValueParams: String =
val unattestedValueParams: String =
"languages=sjn&subjects.label=NotASubject&aggregations=subjects.label"
val bogusValueResponse: String = ""
}

0 comments on commit b3f55a3

Please sign in to comment.