Skip to content

Commit 3c5b4d8

Browse files
algolia-botben-kalmusClaraMuller
committed
feat(specs): add compositions deduplication setting (generated)
algolia/api-clients-automation#5418 Co-authored-by: algolia-bot <[email protected]> Co-authored-by: Ben Kalmus <[email protected]> Co-authored-by: Clara Muller <[email protected]>
1 parent 472b3c4 commit 3c5b4d8

File tree

4 files changed

+111
-1
lines changed

4 files changed

+111
-1
lines changed
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
/** Composition API The Algolia Composition API lets you run composed search requests on your Compositions. ## Client
2+
* libraries Use Algolia's API clients and libraries to reliably integrate Algolia's APIs with your apps. See:
3+
* [Algolia's ecosystem](https://www.algolia.com/doc/guides/getting-started/how-algolia-works/in-depth/ecosystem/) ##
4+
* Base URLs The base URLs for requests to the Composition API are: - `https://{APPLICATION_ID}.algolia.net` -
5+
* `https://{APPLICATION_ID}-dsn.algolia.net`. If your subscription includes a [Distributed Search
6+
* Network](https://dashboard.algolia.com/infra), this ensures that requests are sent to servers closest to users. Both
7+
* URLs provide high availability by distributing requests with load balancing. **All requests must use HTTPS.** ##
8+
* Retry strategy To guarantee high availability, implement a retry strategy for all API requests using the URLs of
9+
* your servers as fallbacks: - `https://{APPLICATION_ID}-1.algolianet.com` -
10+
* `https://{APPLICATION_ID}-2.algolianet.com` - `https://{APPLICATION_ID}-3.algolianet.com` These URLs use a different
11+
* DNS provider than the primary URLs. You should randomize this list to ensure an even load across the three servers.
12+
* All Algolia API clients implement this retry strategy. ## Authentication To authenticate your API requests, add
13+
* these headers: - `x-algolia-application-id`. Your Algolia application ID. - `x-algolia-api-key`. An API key with the
14+
* necessary permissions to make the request. The required access control list (ACL) to make a request is listed in
15+
* each endpoint's reference. You can find your application ID and API key in the [Algolia
16+
* dashboard](https://dashboard.algolia.com/account). ## Request format Depending on the endpoint, request bodies are
17+
* either JSON objects or arrays of JSON objects, ## Parameters Parameters are passed in the request body for POST and
18+
* PUT requests. Query parameters must be
19+
* [URL-encoded](https://developer.mozilla.org/en-US/docs/Glossary/Percent-encoding). Non-ASCII characters must be
20+
* UTF-8 encoded. Plus characters (`+`) are interpreted as spaces. ## Response status and errors The Composition API
21+
* returns JSON responses. Since JSON doesn't guarantee any specific ordering, don't rely on the order of attributes in
22+
* the API response. Successful responses return a `2xx` status. Client errors return a `4xx` status. Server errors are
23+
* indicated by a `5xx` status. Error responses have a `message` property with more information. ## Version The current
24+
* version of the Composition API is version 1, as indicated by the `/1/` in each endpoint's URL.
25+
*
26+
* The version of the OpenAPI document: 1.0.0
27+
*
28+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
29+
* https://openapi-generator.tech Do not edit the class manually.
30+
*/
31+
package algoliasearch.composition
32+
33+
import org.json4s._
34+
35+
sealed trait DedupPositioning
36+
37+
/** Deduplication positioning configures how a duplicate result should be resolved between an injected item and main
38+
* search results. Current configuration supports: - 'highest': always select the item in the highest position, and
39+
* remove duplicates that appear lower in the results. - 'highestInjected': duplicate result will be moved to its
40+
* highest possible injected position, but not higher. If a duplicate appears higher in main search results, it will be
41+
* removed to stay it's intended group position (which could be lower than main).
42+
*/
43+
object DedupPositioning {
44+
case object Highest extends DedupPositioning {
45+
override def toString = "highest"
46+
}
47+
case object HighestInjected extends DedupPositioning {
48+
override def toString = "highestInjected"
49+
}
50+
val values: Seq[DedupPositioning] = Seq(Highest, HighestInjected)
51+
52+
def withName(name: String): DedupPositioning = DedupPositioning.values
53+
.find(_.toString == name)
54+
.getOrElse(throw new MappingException(s"Unknown DedupPositioning value: $name"))
55+
}
56+
57+
class DedupPositioningSerializer
58+
extends CustomSerializer[DedupPositioning](_ =>
59+
(
60+
{
61+
case JString(value) => DedupPositioning.withName(value)
62+
case JNull => null
63+
},
64+
{ case value: DedupPositioning =>
65+
JString(value.toString)
66+
}
67+
)
68+
)
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/** Composition API The Algolia Composition API lets you run composed search requests on your Compositions. ## Client
2+
* libraries Use Algolia's API clients and libraries to reliably integrate Algolia's APIs with your apps. See:
3+
* [Algolia's ecosystem](https://www.algolia.com/doc/guides/getting-started/how-algolia-works/in-depth/ecosystem/) ##
4+
* Base URLs The base URLs for requests to the Composition API are: - `https://{APPLICATION_ID}.algolia.net` -
5+
* `https://{APPLICATION_ID}-dsn.algolia.net`. If your subscription includes a [Distributed Search
6+
* Network](https://dashboard.algolia.com/infra), this ensures that requests are sent to servers closest to users. Both
7+
* URLs provide high availability by distributing requests with load balancing. **All requests must use HTTPS.** ##
8+
* Retry strategy To guarantee high availability, implement a retry strategy for all API requests using the URLs of
9+
* your servers as fallbacks: - `https://{APPLICATION_ID}-1.algolianet.com` -
10+
* `https://{APPLICATION_ID}-2.algolianet.com` - `https://{APPLICATION_ID}-3.algolianet.com` These URLs use a different
11+
* DNS provider than the primary URLs. You should randomize this list to ensure an even load across the three servers.
12+
* All Algolia API clients implement this retry strategy. ## Authentication To authenticate your API requests, add
13+
* these headers: - `x-algolia-application-id`. Your Algolia application ID. - `x-algolia-api-key`. An API key with the
14+
* necessary permissions to make the request. The required access control list (ACL) to make a request is listed in
15+
* each endpoint's reference. You can find your application ID and API key in the [Algolia
16+
* dashboard](https://dashboard.algolia.com/account). ## Request format Depending on the endpoint, request bodies are
17+
* either JSON objects or arrays of JSON objects, ## Parameters Parameters are passed in the request body for POST and
18+
* PUT requests. Query parameters must be
19+
* [URL-encoded](https://developer.mozilla.org/en-US/docs/Glossary/Percent-encoding). Non-ASCII characters must be
20+
* UTF-8 encoded. Plus characters (`+`) are interpreted as spaces. ## Response status and errors The Composition API
21+
* returns JSON responses. Since JSON doesn't guarantee any specific ordering, don't rely on the order of attributes in
22+
* the API response. Successful responses return a `2xx` status. Client errors return a `4xx` status. Server errors are
23+
* indicated by a `5xx` status. Error responses have a `message` property with more information. ## Version The current
24+
* version of the Composition API is version 1, as indicated by the `/1/` in each endpoint's URL.
25+
*
26+
* The version of the OpenAPI document: 1.0.0
27+
*
28+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
29+
* https://openapi-generator.tech Do not edit the class manually.
30+
*/
31+
package algoliasearch.composition
32+
33+
import algoliasearch.composition.DedupPositioning._
34+
35+
/** Deduplication configures the methods used to resolve duplicate items between main search results and injected group
36+
* results.
37+
*/
38+
case class Deduplication(
39+
positioning: DedupPositioning
40+
)

src/main/scala/algoliasearch/composition/Injection.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,5 +37,6 @@ package algoliasearch.composition
3737
*/
3838
case class Injection(
3939
main: Main,
40-
injectedItems: Option[Seq[InjectedItem]] = scala.None
40+
injectedItems: Option[Seq[InjectedItem]] = scala.None,
41+
deduplication: Option[Deduplication] = scala.None
4142
)

src/main/scala/algoliasearch/composition/JsonSupport.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ object JsonSupport {
4040
new AnchoringSerializer() :+
4141
new AroundRadiusAllSerializer() :+
4242
new BooleanStringSerializer() :+
43+
new DedupPositioningSerializer() :+
4344
new ExactOnSingleWordQuerySerializer() :+
4445
new ExternalOrderingSerializer() :+
4546
new MatchLevelSerializer() :+

0 commit comments

Comments
 (0)