@studyportals/fawkes 8.7.2-2 → 8.7.2-3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,2 @@
1
1
  import { FilterKey } from '@studyportals/search-filters/server-side';
2
- import { FilterType } from '@studyportals/omnisearch-interfaces';
3
2
  export declare const FILTER_KEY_TO_FILTER_TYPE_MAP: Map<FilterKey, FilterType>;
@@ -3,4 +3,3 @@ export * from './ISeoFilterState';
3
3
  export * from './ISearchApplicationState';
4
4
  export * from './ISearchIndexabilityManager';
5
5
  export * from './IPresenter';
6
- export * from './FilterTypeMap';
@@ -3,4 +3,3 @@ export * from './ISeoFilterState';
3
3
  export * from './ISearchApplicationState';
4
4
  export * from './ISearchIndexabilityManager';
5
5
  export * from './IPresenter';
6
- export * from './FilterTypeMap';
@@ -7,7 +7,6 @@ export declare class MinimumAmountOfRankedResultsRule implements IRule {
7
7
  constructor(searchApiClient?: ISearchApiClient);
8
8
  forSearch(dependencies: IOrganisationSearchDependencies): Promise<boolean>;
9
9
  forSitemapGenerator(filterKeyValues: FilterKeyValuesMap): Promise<boolean>;
10
- private mapResults;
11
10
  getName(): string;
12
11
  getDescription(): string;
13
12
  }
@@ -1,7 +1,4 @@
1
1
  import { DependencyMissingError } from '../../errors/DependencyMissingError';
2
- import { FILTER_KEY_TO_FILTER_TYPE_MAP } from '../../common/FilterKeyToFilterTypeMap';
3
- import { FilterType } from '@studyportals/omnisearch-interfaces';
4
- import { OrganisationSortType } from '@studyportals/search-api-interface';
5
2
  export class MinimumAmountOfRankedResultsRule {
6
3
  minimumRankedResultsCount = 4;
7
4
  searchApiClient;
@@ -17,22 +14,9 @@ export class MinimumAmountOfRankedResultsRule {
17
14
  if (!this.searchApiClient) {
18
15
  throw new DependencyMissingError('SearchApiClient');
19
16
  }
20
- const mappedResults = this.mapResults(filterKeyValues);
21
- const rankedResultsCount = await this.searchApiClient.getCount(mappedResults);
17
+ const rankedResultsCount = await this.searchApiClient.getCount(filterKeyValues, true);
22
18
  return rankedResultsCount >= this.minimumRankedResultsCount;
23
19
  }
24
- mapResults(filterKeyValues) {
25
- const filterTypeMap = new Map([
26
- [FilterType.SORTING, [OrganisationSortType.RANKINGS]]
27
- ]);
28
- for (const [filterKey, values] of filterKeyValues.entries()) {
29
- const filterType = FILTER_KEY_TO_FILTER_TYPE_MAP.get(filterKey);
30
- if (filterType) {
31
- filterTypeMap.set(filterType, values);
32
- }
33
- }
34
- return filterTypeMap;
35
- }
36
20
  getName() {
37
21
  return 'AtLeastFourRankedResultsRule';
38
22
  }
@@ -9,7 +9,6 @@ export declare class MinimumAmountOfResultsRule implements IRule {
9
9
  constructor(searchApiClient?: ISearchApiClient);
10
10
  forSearch(dependencies: ISearchDependencies): Promise<boolean>;
11
11
  forSitemapGeneratorWithPageNumber(filterKeyValues: FilterKeyValuesMap, pageNumber: number): Promise<boolean>;
12
- private mapResults;
13
12
  forSitemapGenerator(filterKeyValues: FilterKeyValuesMap): Promise<boolean>;
14
13
  getName(): string;
15
14
  getDescription(): string;
@@ -1,7 +1,4 @@
1
1
  import { DependencyMissingError } from '../../errors/DependencyMissingError';
2
- import { FilterType } from '@studyportals/omnisearch-interfaces';
3
- import { OrganisationSortType } from '@studyportals/search-api-interface';
4
- import { FILTER_KEY_TO_FILTER_TYPE_MAP } from '../../common/FilterKeyToFilterTypeMap';
5
2
  export class MinimumAmountOfResultsRule {
6
3
  minimumResultsCount = 7;
7
4
  maximumPageSize = 20;
@@ -18,22 +15,9 @@ export class MinimumAmountOfResultsRule {
18
15
  if (!this.searchApiClient) {
19
16
  throw new DependencyMissingError('SearchApiClient');
20
17
  }
21
- const mappedResults = this.mapResults(filterKeyValues);
22
- const count = await this.searchApiClient.getCount(mappedResults);
18
+ const count = await this.searchApiClient.getCount(filterKeyValues);
23
19
  return count >= (pageNumber - 1) * this.maximumPageSize + this.minimumResultsCount;
24
20
  }
25
- mapResults(filterKeyValues) {
26
- const filterTypeMap = new Map([
27
- [FilterType.SORTING, [OrganisationSortType.RANKINGS]]
28
- ]);
29
- for (const [filterKey, values] of filterKeyValues.entries()) {
30
- const filterType = FILTER_KEY_TO_FILTER_TYPE_MAP.get(filterKey);
31
- if (filterType) {
32
- filterTypeMap.set(filterType, values);
33
- }
34
- }
35
- return filterTypeMap;
36
- }
37
21
  async forSitemapGenerator(filterKeyValues) {
38
22
  if (!this.searchApiClient) {
39
23
  throw new DependencyMissingError('SearchApiClient');
@@ -9,7 +9,6 @@ export declare class MinimumAmountOfResultsRule implements IProgrammeRule {
9
9
  constructor(searchApiClient?: ISearchApiClient);
10
10
  forSearch(dependencies: ISearchDependencies): Promise<boolean>;
11
11
  forSitemapGeneratorWithPageNumber(filterKeyValues: FilterKeyValuesMap, pageNumber: number): Promise<boolean>;
12
- private mapResults;
13
12
  forSitemapGenerator(): Promise<boolean>;
14
13
  getName(): string;
15
14
  getDescription(): string;
@@ -1,7 +1,4 @@
1
1
  import { DependencyMissingError } from '../../errors/DependencyMissingError';
2
- import { FilterType } from '@studyportals/omnisearch-interfaces';
3
- import { OrganisationSortType } from '@studyportals/search-api-interface';
4
- import { FILTER_KEY_TO_FILTER_TYPE_MAP } from '../../common/FilterKeyToFilterTypeMap';
5
2
  export class MinimumAmountOfResultsRule {
6
3
  minimumResultsCount = 7;
7
4
  maximumPageSize = 20;
@@ -18,22 +15,9 @@ export class MinimumAmountOfResultsRule {
18
15
  if (!this.searchApiClient) {
19
16
  throw new DependencyMissingError('SearchApiClient');
20
17
  }
21
- const mappedResults = this.mapResults(filterKeyValues);
22
- const count = await this.searchApiClient.getCount(mappedResults);
18
+ const count = await this.searchApiClient.getCount(filterKeyValues);
23
19
  return count >= (pageNumber - 1) * this.maximumPageSize + this.minimumResultsCount;
24
20
  }
25
- mapResults(filterKeyValues) {
26
- const filterTypeMap = new Map([
27
- [FilterType.SORTING, [OrganisationSortType.RANKINGS]]
28
- ]);
29
- for (const [filterKey, values] of filterKeyValues.entries()) {
30
- const filterType = FILTER_KEY_TO_FILTER_TYPE_MAP.get(filterKey);
31
- if (filterType) {
32
- filterTypeMap.set(filterType, values);
33
- }
34
- }
35
- return filterTypeMap;
36
- }
37
21
  forSitemapGenerator() {
38
22
  throw new Error('Method not implemented.');
39
23
  }
@@ -1,5 +1,4 @@
1
1
  import { FilterKeyValuesMap } from '../common/FilterKeyValuesMap';
2
- import { FilterTypeMap } from '../common/FilterTypeMap';
3
2
  export interface ISearchApiClient {
4
3
  getOrganisationIds(): Promise<number[]>;
5
4
  getCityIds?(): Promise<number[]>;
@@ -11,5 +10,5 @@ export interface ISearchApiClient {
11
10
  countryIsoCode: string;
12
11
  }[]>;
13
12
  getProgrammeCount?(filterKeyValues: FilterKeyValuesMap): Promise<number>;
14
- getCount(filterKeyValues: FilterKeyValuesMap | FilterTypeMap): Promise<number>;
13
+ getCount(filterKeyValues: FilterKeyValuesMap, isRanking?: boolean): Promise<number>;
15
14
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@studyportals/fawkes",
3
- "version": "8.7.2-2",
3
+ "version": "8.7.2-3",
4
4
  "description": "A package to centralize SEO related logic for SBLP and Sitemap Generator.",
5
5
  "files": [
6
6
  "./dist"
@@ -91,8 +91,6 @@
91
91
  },
92
92
  "dependencies": {
93
93
  "@studyportals/domain-client": "^8.1.0",
94
- "@studyportals/omnisearch-interfaces": "^0.2.1",
95
- "@studyportals/ranking-api-interface": "^1.3.12",
96
94
  "@studyportals/search-api-interface": "^5.9.2",
97
95
  "@studyportals/search-filters": "^6.3.1",
98
96
  "@studyportals/static-domain-data": "^6.1.0"