Skip to content

Commit

Permalink
fix(specs): make the searchParams compatible with v4 [skip-bc] (gener…
Browse files Browse the repository at this point in the history
…ated)

algolia/api-clients-automation#4108

Co-authored-by: algolia-bot <accounts+algolia-api-client-bot@algolia.com>
Co-authored-by: Pierre Millot <pierre.millot@algolia.com>
  • Loading branch information
algolia-bot and millotp committed Nov 15, 2024
1 parent 1148a93 commit a4e93d0
Show file tree
Hide file tree
Showing 68 changed files with 445 additions and 604 deletions.
12 changes: 10 additions & 2 deletions packages/algoliasearch/lib/src/model/base_index_settings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ final class BaseIndexSettings {
this.userData,
this.customNormalization,
this.attributeForDistinct,
this.maxFacetHits,
});

/// Attributes used for [faceting](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/). Facets are attributes that let you categorize search results. They can be used for filtering search results. By default, no attribute is used for faceting. Attribute names are case-sensitive. **Modifiers** - `filterOnly(\"ATTRIBUTE\")`. Allows the attribute to be used as a filter but doesn't evaluate the facet values. - `searchable(\"ATTRIBUTE\")`. Allows searching for facet values. - `afterDistinct(\"ATTRIBUTE\")`. Evaluates the facet count _after_ deduplication with `distinct`. This ensures accurate facet counts. You can apply this modifier to searchable facets: `afterDistinct(searchable(ATTRIBUTE))`.
Expand Down Expand Up @@ -98,6 +99,11 @@ final class BaseIndexSettings {
@JsonKey(name: r'attributeForDistinct')
final String? attributeForDistinct;

/// Maximum number of facet values to return when [searching for facet values](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/#search-for-facet-values).
// maximum: 100
@JsonKey(name: r'maxFacetHits')
final int? maxFacetHits;

@override
bool operator ==(Object other) =>
identical(this, other) ||
Expand All @@ -120,7 +126,8 @@ final class BaseIndexSettings {
other.searchableAttributes == searchableAttributes &&
other.userData == userData &&
other.customNormalization == customNormalization &&
other.attributeForDistinct == attributeForDistinct;
other.attributeForDistinct == attributeForDistinct &&
other.maxFacetHits == maxFacetHits;

@override
int get hashCode =>
Expand All @@ -140,7 +147,8 @@ final class BaseIndexSettings {
searchableAttributes.hashCode +
userData.hashCode +
customNormalization.hashCode +
attributeForDistinct.hashCode;
attributeForDistinct.hashCode +
maxFacetHits.hashCode;

factory BaseIndexSettings.fromJson(Map<String, dynamic> json) =>
_$BaseIndexSettingsFromJson(json);
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
// ignore_for_file: unused_element
import 'package:algoliasearch/src/model/advanced_syntax_features.dart';
import 'package:algoliasearch/src/model/supported_language.dart';
import 'package:algoliasearch/src/model/rendering_content.dart';
import 'package:algoliasearch/src/model/remove_words_if_no_results.dart';
import 'package:algoliasearch/src/model/query_type.dart';
import 'package:algoliasearch/src/model/exact_on_single_word_query.dart';
import 'package:algoliasearch/src/model/rendering_content.dart';
import 'package:algoliasearch/src/model/alternatives_as_exact.dart';

import 'package:json_annotation/json_annotation.dart';
Expand Down Expand Up @@ -48,7 +48,6 @@ final class BaseRecommendIndexSettings {
this.replaceSynonymsInHighlight,
this.minProximity,
this.responseFields,
this.maxFacetHits,
this.maxValuesPerFacet,
this.sortFacetValuesBy,
this.attributeCriteriaComputedByMinProximity,
Expand Down Expand Up @@ -154,9 +153,11 @@ final class BaseRecommendIndexSettings {
@JsonKey(name: r'advancedSyntax')
final bool? advancedSyntax;

/// Words that should be considered optional when found in the query. By default, records must match all words in the search query to be included in the search results. Adding optional words can help to increase the number of search results by running an additional search query that doesn't include the optional words. For example, if the search query is \"action video\" and \"video\" is an optional word, the search engine runs two queries. One for \"action video\" and one for \"action\". Records that match all words are ranked higher. For a search query with 4 or more words **and** all its words are optional, the number of matched words required for a record to be included in the search results increases for every 1,000 records: - If `optionalWords` has less than 10 words, the required number of matched words increases by 1: results 1 to 1,000 require 1 matched word, results 1,001 to 2000 need 2 matched words. - If `optionalWords` has 10 or more words, the number of required matched words increases by the number of optional words divided by 5 (rounded down). For example, with 18 optional words: results 1 to 1,000 require 1 matched word, results 1,001 to 2000 need 4 matched words. For more information, see [Optional words](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/empty-or-insufficient-results/#creating-a-list-of-optional-words).
/// One of types:
/// - [String]
/// - [List<String>]
@JsonKey(name: r'optionalWords')
final List<String>? optionalWords;
final dynamic optionalWords;

/// Searchable attributes for which you want to [turn off the Exact ranking criterion](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/override-search-engine-defaults/in-depth/adjust-exact-settings/#turn-off-exact-for-some-attributes). Attribute names are case-sensitive. This can be useful for attributes with long values, where the likelihood of an exact match is high, such as product descriptions. Turning off the Exact ranking criterion for these attributes favors exact matching on other attributes. This reduces the impact of individual attributes with a lot of content on ranking.
@JsonKey(name: r'disableExactOnAttributes')
Expand Down Expand Up @@ -193,11 +194,6 @@ final class BaseRecommendIndexSettings {
@JsonKey(name: r'responseFields')
final List<String>? responseFields;

/// Maximum number of facet values to return when [searching for facet values](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/#search-for-facet-values).
// maximum: 100
@JsonKey(name: r'maxFacetHits')
final int? maxFacetHits;

/// Maximum number of facet values to return for each facet.
// maximum: 1000
@JsonKey(name: r'maxValuesPerFacet')
Expand Down Expand Up @@ -263,7 +259,6 @@ final class BaseRecommendIndexSettings {
other.replaceSynonymsInHighlight == replaceSynonymsInHighlight &&
other.minProximity == minProximity &&
other.responseFields == responseFields &&
other.maxFacetHits == maxFacetHits &&
other.maxValuesPerFacet == maxValuesPerFacet &&
other.sortFacetValuesBy == sortFacetValuesBy &&
other.attributeCriteriaComputedByMinProximity ==
Expand Down Expand Up @@ -297,7 +292,7 @@ final class BaseRecommendIndexSettings {
queryType.hashCode +
removeWordsIfNoResults.hashCode +
advancedSyntax.hashCode +
optionalWords.hashCode +
(optionalWords == null ? 0 : optionalWords.hashCode) +
disableExactOnAttributes.hashCode +
exactOnSingleWordQuery.hashCode +
alternativesAsExact.hashCode +
Expand All @@ -306,7 +301,6 @@ final class BaseRecommendIndexSettings {
replaceSynonymsInHighlight.hashCode +
minProximity.hashCode +
responseFields.hashCode +
maxFacetHits.hashCode +
maxValuesPerFacet.hashCode +
sortFacetValuesBy.hashCode +
attributeCriteriaComputedByMinProximity.hashCode +
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,11 @@ final class BaseRecommendSearchParams {
@JsonKey(name: r'minimumAroundRadius')
final int? minimumAroundRadius;

/// Coordinates for a rectangular area in which to search. Each bounding box is defined by the two opposite points of its diagonal, and expressed as latitude and longitude pair: `[p1 lat, p1 long, p2 lat, p2 long]`. Provide multiple bounding boxes as nested arrays. For more information, see [rectangular area](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filtering-inside-rectangular-or-polygonal-areas).
/// One of types:
/// - [List<List<double>>]
/// - [String]
@JsonKey(name: r'insideBoundingBox')
final List<List<double>>? insideBoundingBox;
final dynamic insideBoundingBox;

/// Coordinates of a polygon in which to search. Polygons are defined by 3 to 10,000 points. Each point is represented by its latitude and longitude. Provide multiple polygons as nested arrays. For more information, see [filtering inside polygons](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filtering-inside-rectangular-or-polygonal-areas). This parameter is ignored if you also specify `insideBoundingBox`.
@JsonKey(name: r'insidePolygon')
Expand Down Expand Up @@ -221,7 +223,7 @@ final class BaseRecommendSearchParams {
aroundRadius.hashCode +
aroundPrecision.hashCode +
minimumAroundRadius.hashCode +
insideBoundingBox.hashCode +
(insideBoundingBox == null ? 0 : insideBoundingBox.hashCode) +
insidePolygon.hashCode +
naturalLanguages.hashCode +
ruleContexts.hashCode +
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 5 additions & 3 deletions packages/algoliasearch/lib/src/model/base_search_params.dart
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,11 @@ final class BaseSearchParams {
@JsonKey(name: r'minimumAroundRadius')
final int? minimumAroundRadius;

/// Coordinates for a rectangular area in which to search. Each bounding box is defined by the two opposite points of its diagonal, and expressed as latitude and longitude pair: `[p1 lat, p1 long, p2 lat, p2 long]`. Provide multiple bounding boxes as nested arrays. For more information, see [rectangular area](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filtering-inside-rectangular-or-polygonal-areas).
/// One of types:
/// - [List<List<double>>]
/// - [String]
@JsonKey(name: r'insideBoundingBox')
final List<List<double>>? insideBoundingBox;
final dynamic insideBoundingBox;

/// Coordinates of a polygon in which to search. Polygons are defined by 3 to 10,000 points. Each point is represented by its latitude and longitude. Provide multiple polygons as nested arrays. For more information, see [filtering inside polygons](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filtering-inside-rectangular-or-polygonal-areas). This parameter is ignored if you also specify `insideBoundingBox`.
@JsonKey(name: r'insidePolygon')
Expand Down Expand Up @@ -252,7 +254,7 @@ final class BaseSearchParams {
aroundRadius.hashCode +
aroundPrecision.hashCode +
minimumAroundRadius.hashCode +
insideBoundingBox.hashCode +
(insideBoundingBox == null ? 0 : insideBoundingBox.hashCode) +
insidePolygon.hashCode +
naturalLanguages.hashCode +
ruleContexts.hashCode +
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,11 @@ final class BaseSearchParamsWithoutQuery {
@JsonKey(name: r'minimumAroundRadius')
final int? minimumAroundRadius;

/// Coordinates for a rectangular area in which to search. Each bounding box is defined by the two opposite points of its diagonal, and expressed as latitude and longitude pair: `[p1 lat, p1 long, p2 lat, p2 long]`. Provide multiple bounding boxes as nested arrays. For more information, see [rectangular area](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filtering-inside-rectangular-or-polygonal-areas).
/// One of types:
/// - [List<List<double>>]
/// - [String]
@JsonKey(name: r'insideBoundingBox')
final List<List<double>>? insideBoundingBox;
final dynamic insideBoundingBox;

/// Coordinates of a polygon in which to search. Polygons are defined by 3 to 10,000 points. Each point is represented by its latitude and longitude. Provide multiple polygons as nested arrays. For more information, see [filtering inside polygons](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filtering-inside-rectangular-or-polygonal-areas). This parameter is ignored if you also specify `insideBoundingBox`.
@JsonKey(name: r'insidePolygon')
Expand Down Expand Up @@ -245,7 +247,7 @@ final class BaseSearchParamsWithoutQuery {
aroundRadius.hashCode +
aroundPrecision.hashCode +
minimumAroundRadius.hashCode +
insideBoundingBox.hashCode +
(insideBoundingBox == null ? 0 : insideBoundingBox.hashCode) +
insidePolygon.hashCode +
naturalLanguages.hashCode +
ruleContexts.hashCode +
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit a4e93d0

Please sign in to comment.