@studyportals/fawkes 8.5.3-1 → 8.5.3-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.
- package/README.md +176 -176
- package/dist/src/enums/FilterCombinations.d.ts +0 -2
- package/dist/src/enums/FilterCombinations.js +0 -2
- package/dist/src/organisations/SearchIndexabilityManager.js +1 -3
- package/dist/src/organisations/policies/index.d.ts +0 -2
- package/dist/src/organisations/policies/index.js +0 -2
- package/dist/src/programmes/ProgrammesBaseIndexabilityPolicy.js +5 -0
- package/dist/src/programmes/policies/AttendanceDegree.d.ts +2 -5
- package/dist/src/programmes/policies/AttendanceDegree.js +11 -7
- package/dist/src/programmes/policies/CountryAttendanceDegree.js +1 -1
- package/dist/src/programmes/policies/CountryDegree.d.ts +2 -4
- package/dist/src/programmes/policies/CountryDegree.js +10 -6
- package/dist/src/programmes/policies/CountryDurationDegree.js +1 -1
- package/dist/src/programmes/policies/CountryEducationalForm.d.ts +2 -4
- package/dist/src/programmes/policies/CountryEducationalForm.js +11 -7
- package/dist/src/programmes/policies/DegreeAttendanceTuitionFee.d.ts +2 -6
- package/dist/src/programmes/policies/DegreeAttendanceTuitionFee.js +13 -9
- package/dist/src/programmes/policies/DegreeContinent.d.ts +2 -4
- package/dist/src/programmes/policies/DegreeContinent.js +10 -6
- package/dist/src/programmes/policies/DegreeContinentTuitionFee.d.ts +2 -4
- package/dist/src/programmes/policies/DegreeContinentTuitionFee.js +11 -7
- package/dist/src/programmes/policies/DegreeDuration.d.ts +2 -5
- package/dist/src/programmes/policies/DegreeDuration.js +11 -7
- package/dist/src/programmes/policies/DegreeFormat.d.ts +2 -4
- package/dist/src/programmes/policies/DegreeFormat.js +10 -6
- package/dist/src/programmes/policies/DegreeFormatTuitionFee.d.ts +2 -6
- package/dist/src/programmes/policies/DegreeFormatTuitionFee.js +13 -9
- package/dist/src/programmes/policies/DisciplineCountryEducationalForm.d.ts +2 -4
- package/dist/src/programmes/policies/DisciplineCountryEducationalForm.js +12 -8
- package/dist/src/programmes/policies/DisciplineEducationalForm.d.ts +2 -4
- package/dist/src/programmes/policies/DisciplineEducationalForm.js +11 -7
- package/dist/src/programmes/rules/IndexableDegreeRule.d.ts +4 -1
- package/dist/src/programmes/rules/IndexableDegreeRule.js +53 -27
- package/dist/src/programmes/rules/IndexableEducationalFormRule.d.ts +3 -0
- package/dist/src/programmes/rules/IndexableEducationalFormRule.js +18 -5
- package/dist/src/sitemap-generator/OrganisationsSitemapUrlGeneratorManager.js +1 -3
- package/package.json +105 -105
- package/dist/src/organisations/policies/ranked/RankedCountryAreaCity.d.ts +0 -13
- package/dist/src/organisations/policies/ranked/RankedCountryAreaCity.js +0 -43
- package/dist/src/organisations/policies/ranked/RankedCountryCity.d.ts +0 -14
- package/dist/src/organisations/policies/ranked/RankedCountryCity.js +0 -41
package/README.md
CHANGED
|
@@ -1,176 +1,176 @@
|
|
|
1
|
-
# fawkes
|
|
2
|
-
|
|
3
|
-
This project is used to centralize indexability logic for our Search
|
|
4
|
-
microservices and Sitemap Generator. The main purpose is to completely remove
|
|
5
|
-
discrepancies between pages indexed by Search and page URLs stored in Sitemap.
|
|
6
|
-
|
|
7
|
-
Link to documentation: https://studyportals.atlassian.net/wiki/x/BwAdvw
|
|
8
|
-
|
|
9
|
-
## Base structure
|
|
10
|
-
|
|
11
|
-
- organisations-seo (used by Organisation Search)
|
|
12
|
-
- scholarships-seo (used by Scholarship Search)
|
|
13
|
-
- sitemap-generator-seo (used by Sitemap Generator)
|
|
14
|
-
- src
|
|
15
|
-
- common
|
|
16
|
-
- organisations
|
|
17
|
-
- scholarships
|
|
18
|
-
- sitemap-generator
|
|
19
|
-
|
|
20
|
-
# Automatic Documentation System
|
|
21
|
-
|
|
22
|
-
## Overview
|
|
23
|
-
|
|
24
|
-
This system automatically generates and maintains documentation for Fawkes
|
|
25
|
-
indexing rules across multiple projects. It creates a hierarchical structure of
|
|
26
|
-
Confluence pages that document all indexing policies and rules, ensuring that
|
|
27
|
-
the documentation is always up-to-date with the actual codebase.
|
|
28
|
-
|
|
29
|
-
Link to documentation:
|
|
30
|
-
[Fawkes Indexing Rules Documentation](https://studyportals.atlassian.net/wiki/spaces/T/pages/3494969354/Fawkes+Indexing+Rules+Documentation)
|
|
31
|
-
|
|
32
|
-
## Features
|
|
33
|
-
|
|
34
|
-
- **Dynamic Documentation**: Automatically extracts indexing rules and policies
|
|
35
|
-
directly from the codebase
|
|
36
|
-
- **Multi-Page Structure**: Creates a main index page with separate pages for
|
|
37
|
-
each project
|
|
38
|
-
- **Hierarchical Organization**: Structures content as Projects → Policies →
|
|
39
|
-
Rules
|
|
40
|
-
- **Automatic Page Creation**: Intelligently creates or updates pages as needed
|
|
41
|
-
- **Cross-Page Navigation**: Provides intuitive navigation between all pages
|
|
42
|
-
|
|
43
|
-
## Architecture
|
|
44
|
-
|
|
45
|
-
The system follows SOLID design principles to ensure maintainability and
|
|
46
|
-
extensibility:
|
|
47
|
-
|
|
48
|
-
- **Single Responsibility**: Each class has one specific responsibility
|
|
49
|
-
- **Open/Closed**: Easily extendable without modifying existing code
|
|
50
|
-
- **Liskov Substitution**: Interchangeable components through well-defined
|
|
51
|
-
interfaces
|
|
52
|
-
- **Interface Segregation**: Clean, focused interfaces
|
|
53
|
-
- **Dependency Inversion**: High-level modules depend on abstractions
|
|
54
|
-
|
|
55
|
-
### Key Components
|
|
56
|
-
|
|
57
|
-
1. **Content Builder**: Extracts project, policy, and rule data from the Fawkes
|
|
58
|
-
system
|
|
59
|
-
2. **Policy Fetchers**: Project-specific components that fetch and format policy
|
|
60
|
-
data
|
|
61
|
-
3. **Document Builder**: Generates structured HTML content for Confluence pages
|
|
62
|
-
4. **Confluence Updater**: Handles creation and updating of Confluence pages
|
|
63
|
-
5. **Token Retriever**: Securely retrieves API token for Confluence access
|
|
64
|
-
|
|
65
|
-
## How It Works
|
|
66
|
-
|
|
67
|
-
1. The system starts by collecting all project data using the `ContentBuilder`
|
|
68
|
-
2. For each project, it extracts policies and rules using project-specific
|
|
69
|
-
fetchers
|
|
70
|
-
3. The `DocumentBuilder` generates the content for the main index page and each
|
|
71
|
-
project page
|
|
72
|
-
4. The `ConfluenceUpdater` creates or updates pages in Confluence as needed
|
|
73
|
-
5. Each project page links back to the main index, and the main index links to
|
|
74
|
-
all project pages
|
|
75
|
-
|
|
76
|
-
## Setup and Configuration
|
|
77
|
-
|
|
78
|
-
### Environment Variables
|
|
79
|
-
|
|
80
|
-
The system requires the following environment variables:
|
|
81
|
-
|
|
82
|
-
```
|
|
83
|
-
CONFLUENCE_EMAIL=your-email@example.com
|
|
84
|
-
CONFLUENCE_API_TOKEN=your-api-token
|
|
85
|
-
CONFLUENCE_BASE_URL=https://your-instance.atlassian.net
|
|
86
|
-
CONFLUENCE_SPACE_KEY=YOUR_SPACE_KEY
|
|
87
|
-
CONFLUENCE_MAIN_PAGE_TITLE=Fawkes Indexing Rules Documentation
|
|
88
|
-
```
|
|
89
|
-
|
|
90
|
-
> **Important Note on Credentials**: Currently, the system uses personal
|
|
91
|
-
> credentials (email and API token) for Confluence access. This is a temporary
|
|
92
|
-
> solution and should be replaced with a team or service account in the future
|
|
93
|
-
> to avoid dependency on a specific individual's account.
|
|
94
|
-
|
|
95
|
-
### Deployment and Triggering
|
|
96
|
-
|
|
97
|
-
The system runs as an AWS Lambda function and is automatically triggered as part
|
|
98
|
-
of the CI/CD pipeline. This ensures documentation is always updated whenever new
|
|
99
|
-
code is deployed:
|
|
100
|
-
|
|
101
|
-
```yaml
|
|
102
|
-
# buildspec.yml (excerpt)
|
|
103
|
-
post_build:
|
|
104
|
-
commands:
|
|
105
|
-
- |
|
|
106
|
-
if [ -z "$PR_ID" ]; then
|
|
107
|
-
LAMBDA_NAME="FawkesConfluenceUpdater-$STAGE"
|
|
108
|
-
echo "Invoking Lambda function $LAMBDA_NAME"
|
|
109
|
-
echo '{"source":"cicd-pipeline","timestamp":"'$(date -u +"%Y-%m-%dT%H:%M:%SZ")'"}' > payload.json
|
|
110
|
-
aws lambda invoke --function-name $LAMBDA_NAME --invocation-type Event --payload fileb://payload.json response.json || echo "Lambda invocation failed, but continuing"
|
|
111
|
-
fi
|
|
112
|
-
```
|
|
113
|
-
|
|
114
|
-
**Trigger Flow:**
|
|
115
|
-
|
|
116
|
-
1. When code is pushed to the `main` branch, the CI/CD pipeline is triggered
|
|
117
|
-
2. After successful deployment of a new Fawkes version, the post-build phase
|
|
118
|
-
executes
|
|
119
|
-
3. The Lambda function is invoked with a simple payload containing the source
|
|
120
|
-
and timestamp
|
|
121
|
-
4. The Lambda function authenticates with Confluence and executes the
|
|
122
|
-
documentation generation process
|
|
123
|
-
5. This only happens for production deployments (not PR builds)
|
|
124
|
-
|
|
125
|
-
This automated approach ensures documentation stays in sync with the actual
|
|
126
|
-
codebase without manual intervention.
|
|
127
|
-
|
|
128
|
-
## Scalability and Extension
|
|
129
|
-
|
|
130
|
-
### Adding New Projects
|
|
131
|
-
|
|
132
|
-
To add documentation for a new project:
|
|
133
|
-
|
|
134
|
-
1. Create a new class that implements the `IPolicyFetcher` interface
|
|
135
|
-
2. Implement the `getProjectName()` and `fetchPolicies()` methods
|
|
136
|
-
3. Register the new fetcher in the `ContentBuilder` constructor
|
|
137
|
-
|
|
138
|
-
Example:
|
|
139
|
-
|
|
140
|
-
```typescript
|
|
141
|
-
export class NewProjectPolicyFetcher implements IPolicyFetcher {
|
|
142
|
-
getProjectName(): string {
|
|
143
|
-
return 'New Project Name';
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
fetchPolicies(): IPolicy[] {
|
|
147
|
-
// Implement policy fetching logic
|
|
148
|
-
return [...policies];
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
// Then update ContentBuilder:
|
|
153
|
-
constructor(fetchers?: IPolicyFetcher[]) {
|
|
154
|
-
this.policyFetchers = fetchers || [
|
|
155
|
-
// Existing fetchers
|
|
156
|
-
new NewProjectPolicyFetcher()
|
|
157
|
-
];
|
|
158
|
-
}
|
|
159
|
-
```
|
|
160
|
-
|
|
161
|
-
### Customizing Page Content
|
|
162
|
-
|
|
163
|
-
The `DocumentBuilder` class contains methods for generating page content. To
|
|
164
|
-
customize the format:
|
|
165
|
-
|
|
166
|
-
1. Modify the `buildMainDocument()` method for changes to the main index page
|
|
167
|
-
2. Modify the `buildProjectDocument()` method for changes to project pages
|
|
168
|
-
3. Modify the `buildPolicySection()` and `buildRulesTable()` methods for changes
|
|
169
|
-
to policy and rule sections
|
|
170
|
-
|
|
171
|
-
## Conclusion
|
|
172
|
-
|
|
173
|
-
This documentation system ensures that Fawkes indexing rules are always
|
|
174
|
-
well-documented and accessible to the team. By automatically generating
|
|
175
|
-
documentation directly from the codebase, it eliminates the risk of
|
|
176
|
-
documentation becoming outdated or inconsistent with the actual implementation.
|
|
1
|
+
# fawkes
|
|
2
|
+
|
|
3
|
+
This project is used to centralize indexability logic for our Search
|
|
4
|
+
microservices and Sitemap Generator. The main purpose is to completely remove
|
|
5
|
+
discrepancies between pages indexed by Search and page URLs stored in Sitemap.
|
|
6
|
+
|
|
7
|
+
Link to documentation: https://studyportals.atlassian.net/wiki/x/BwAdvw
|
|
8
|
+
|
|
9
|
+
## Base structure
|
|
10
|
+
|
|
11
|
+
- organisations-seo (used by Organisation Search)
|
|
12
|
+
- scholarships-seo (used by Scholarship Search)
|
|
13
|
+
- sitemap-generator-seo (used by Sitemap Generator)
|
|
14
|
+
- src
|
|
15
|
+
- common
|
|
16
|
+
- organisations
|
|
17
|
+
- scholarships
|
|
18
|
+
- sitemap-generator
|
|
19
|
+
|
|
20
|
+
# Automatic Documentation System
|
|
21
|
+
|
|
22
|
+
## Overview
|
|
23
|
+
|
|
24
|
+
This system automatically generates and maintains documentation for Fawkes
|
|
25
|
+
indexing rules across multiple projects. It creates a hierarchical structure of
|
|
26
|
+
Confluence pages that document all indexing policies and rules, ensuring that
|
|
27
|
+
the documentation is always up-to-date with the actual codebase.
|
|
28
|
+
|
|
29
|
+
Link to documentation:
|
|
30
|
+
[Fawkes Indexing Rules Documentation](https://studyportals.atlassian.net/wiki/spaces/T/pages/3494969354/Fawkes+Indexing+Rules+Documentation)
|
|
31
|
+
|
|
32
|
+
## Features
|
|
33
|
+
|
|
34
|
+
- **Dynamic Documentation**: Automatically extracts indexing rules and policies
|
|
35
|
+
directly from the codebase
|
|
36
|
+
- **Multi-Page Structure**: Creates a main index page with separate pages for
|
|
37
|
+
each project
|
|
38
|
+
- **Hierarchical Organization**: Structures content as Projects → Policies →
|
|
39
|
+
Rules
|
|
40
|
+
- **Automatic Page Creation**: Intelligently creates or updates pages as needed
|
|
41
|
+
- **Cross-Page Navigation**: Provides intuitive navigation between all pages
|
|
42
|
+
|
|
43
|
+
## Architecture
|
|
44
|
+
|
|
45
|
+
The system follows SOLID design principles to ensure maintainability and
|
|
46
|
+
extensibility:
|
|
47
|
+
|
|
48
|
+
- **Single Responsibility**: Each class has one specific responsibility
|
|
49
|
+
- **Open/Closed**: Easily extendable without modifying existing code
|
|
50
|
+
- **Liskov Substitution**: Interchangeable components through well-defined
|
|
51
|
+
interfaces
|
|
52
|
+
- **Interface Segregation**: Clean, focused interfaces
|
|
53
|
+
- **Dependency Inversion**: High-level modules depend on abstractions
|
|
54
|
+
|
|
55
|
+
### Key Components
|
|
56
|
+
|
|
57
|
+
1. **Content Builder**: Extracts project, policy, and rule data from the Fawkes
|
|
58
|
+
system
|
|
59
|
+
2. **Policy Fetchers**: Project-specific components that fetch and format policy
|
|
60
|
+
data
|
|
61
|
+
3. **Document Builder**: Generates structured HTML content for Confluence pages
|
|
62
|
+
4. **Confluence Updater**: Handles creation and updating of Confluence pages
|
|
63
|
+
5. **Token Retriever**: Securely retrieves API token for Confluence access
|
|
64
|
+
|
|
65
|
+
## How It Works
|
|
66
|
+
|
|
67
|
+
1. The system starts by collecting all project data using the `ContentBuilder`
|
|
68
|
+
2. For each project, it extracts policies and rules using project-specific
|
|
69
|
+
fetchers
|
|
70
|
+
3. The `DocumentBuilder` generates the content for the main index page and each
|
|
71
|
+
project page
|
|
72
|
+
4. The `ConfluenceUpdater` creates or updates pages in Confluence as needed
|
|
73
|
+
5. Each project page links back to the main index, and the main index links to
|
|
74
|
+
all project pages
|
|
75
|
+
|
|
76
|
+
## Setup and Configuration
|
|
77
|
+
|
|
78
|
+
### Environment Variables
|
|
79
|
+
|
|
80
|
+
The system requires the following environment variables:
|
|
81
|
+
|
|
82
|
+
```
|
|
83
|
+
CONFLUENCE_EMAIL=your-email@example.com
|
|
84
|
+
CONFLUENCE_API_TOKEN=your-api-token
|
|
85
|
+
CONFLUENCE_BASE_URL=https://your-instance.atlassian.net
|
|
86
|
+
CONFLUENCE_SPACE_KEY=YOUR_SPACE_KEY
|
|
87
|
+
CONFLUENCE_MAIN_PAGE_TITLE=Fawkes Indexing Rules Documentation
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
> **Important Note on Credentials**: Currently, the system uses personal
|
|
91
|
+
> credentials (email and API token) for Confluence access. This is a temporary
|
|
92
|
+
> solution and should be replaced with a team or service account in the future
|
|
93
|
+
> to avoid dependency on a specific individual's account.
|
|
94
|
+
|
|
95
|
+
### Deployment and Triggering
|
|
96
|
+
|
|
97
|
+
The system runs as an AWS Lambda function and is automatically triggered as part
|
|
98
|
+
of the CI/CD pipeline. This ensures documentation is always updated whenever new
|
|
99
|
+
code is deployed:
|
|
100
|
+
|
|
101
|
+
```yaml
|
|
102
|
+
# buildspec.yml (excerpt)
|
|
103
|
+
post_build:
|
|
104
|
+
commands:
|
|
105
|
+
- |
|
|
106
|
+
if [ -z "$PR_ID" ]; then
|
|
107
|
+
LAMBDA_NAME="FawkesConfluenceUpdater-$STAGE"
|
|
108
|
+
echo "Invoking Lambda function $LAMBDA_NAME"
|
|
109
|
+
echo '{"source":"cicd-pipeline","timestamp":"'$(date -u +"%Y-%m-%dT%H:%M:%SZ")'"}' > payload.json
|
|
110
|
+
aws lambda invoke --function-name $LAMBDA_NAME --invocation-type Event --payload fileb://payload.json response.json || echo "Lambda invocation failed, but continuing"
|
|
111
|
+
fi
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
**Trigger Flow:**
|
|
115
|
+
|
|
116
|
+
1. When code is pushed to the `main` branch, the CI/CD pipeline is triggered
|
|
117
|
+
2. After successful deployment of a new Fawkes version, the post-build phase
|
|
118
|
+
executes
|
|
119
|
+
3. The Lambda function is invoked with a simple payload containing the source
|
|
120
|
+
and timestamp
|
|
121
|
+
4. The Lambda function authenticates with Confluence and executes the
|
|
122
|
+
documentation generation process
|
|
123
|
+
5. This only happens for production deployments (not PR builds)
|
|
124
|
+
|
|
125
|
+
This automated approach ensures documentation stays in sync with the actual
|
|
126
|
+
codebase without manual intervention.
|
|
127
|
+
|
|
128
|
+
## Scalability and Extension
|
|
129
|
+
|
|
130
|
+
### Adding New Projects
|
|
131
|
+
|
|
132
|
+
To add documentation for a new project:
|
|
133
|
+
|
|
134
|
+
1. Create a new class that implements the `IPolicyFetcher` interface
|
|
135
|
+
2. Implement the `getProjectName()` and `fetchPolicies()` methods
|
|
136
|
+
3. Register the new fetcher in the `ContentBuilder` constructor
|
|
137
|
+
|
|
138
|
+
Example:
|
|
139
|
+
|
|
140
|
+
```typescript
|
|
141
|
+
export class NewProjectPolicyFetcher implements IPolicyFetcher {
|
|
142
|
+
getProjectName(): string {
|
|
143
|
+
return 'New Project Name';
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
fetchPolicies(): IPolicy[] {
|
|
147
|
+
// Implement policy fetching logic
|
|
148
|
+
return [...policies];
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
// Then update ContentBuilder:
|
|
153
|
+
constructor(fetchers?: IPolicyFetcher[]) {
|
|
154
|
+
this.policyFetchers = fetchers || [
|
|
155
|
+
// Existing fetchers
|
|
156
|
+
new NewProjectPolicyFetcher()
|
|
157
|
+
];
|
|
158
|
+
}
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
### Customizing Page Content
|
|
162
|
+
|
|
163
|
+
The `DocumentBuilder` class contains methods for generating page content. To
|
|
164
|
+
customize the format:
|
|
165
|
+
|
|
166
|
+
1. Modify the `buildMainDocument()` method for changes to the main index page
|
|
167
|
+
2. Modify the `buildProjectDocument()` method for changes to project pages
|
|
168
|
+
3. Modify the `buildPolicySection()` and `buildRulesTable()` methods for changes
|
|
169
|
+
to policy and rule sections
|
|
170
|
+
|
|
171
|
+
## Conclusion
|
|
172
|
+
|
|
173
|
+
This documentation system ensures that Fawkes indexing rules are always
|
|
174
|
+
well-documented and accessible to the team. By automatically generating
|
|
175
|
+
documentation directly from the codebase, it eliminates the risk of
|
|
176
|
+
documentation becoming outdated or inconsistent with the actual implementation.
|
|
@@ -73,8 +73,6 @@ export declare enum FilterCombinations {
|
|
|
73
73
|
RANKED_CONTINENT = "rankedContinent",
|
|
74
74
|
RANKED_CONTINENT_ATTENDANCE = "rankedContinentAttendance",
|
|
75
75
|
RANKED_COUNTRY = "rankedCountry",
|
|
76
|
-
RANKED_COUNTRY_CITY = "rankedCountryCity",
|
|
77
|
-
RANKED_COUNTRY_AREA_CITY = "rankedCountryAreaCity",
|
|
78
76
|
RANKED_COUNTRY_ATTENDANCE = "rankedCountryAttendance",
|
|
79
77
|
RANKED_DISCIPLINE_COUNTRY = "rankedDisciplineCountry",
|
|
80
78
|
RANKED_DISCIPLINE = "rankedDiscipline",
|
|
@@ -74,8 +74,6 @@ export var FilterCombinations;
|
|
|
74
74
|
FilterCombinations["RANKED_CONTINENT"] = "rankedContinent";
|
|
75
75
|
FilterCombinations["RANKED_CONTINENT_ATTENDANCE"] = "rankedContinentAttendance";
|
|
76
76
|
FilterCombinations["RANKED_COUNTRY"] = "rankedCountry";
|
|
77
|
-
FilterCombinations["RANKED_COUNTRY_CITY"] = "rankedCountryCity";
|
|
78
|
-
FilterCombinations["RANKED_COUNTRY_AREA_CITY"] = "rankedCountryAreaCity";
|
|
79
77
|
FilterCombinations["RANKED_COUNTRY_ATTENDANCE"] = "rankedCountryAttendance";
|
|
80
78
|
FilterCombinations["RANKED_DISCIPLINE_COUNTRY"] = "rankedDisciplineCountry";
|
|
81
79
|
FilterCombinations["RANKED_DISCIPLINE"] = "rankedDiscipline";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DependencyTypes } from '../enums/DependencyTypes';
|
|
2
|
-
import { Area, AreaAttendance, Attendance, Continent, Country, CountryAttendance, Unfiltered, RankedArea, RankedAreaDiscipline, RankedAttendance, RankedAttendanceDiscipline, RankedContinent, RankedContinentAttendance, RankedCountry, RankedCountryAttendance, RankedCountryDiscipline, RankedDiscipline, RankedUnfiltered, CountryCity, CountryAreaCity
|
|
2
|
+
import { Area, AreaAttendance, Attendance, Continent, Country, CountryAttendance, Unfiltered, RankedArea, RankedAreaDiscipline, RankedAttendance, RankedAttendanceDiscipline, RankedContinent, RankedContinentAttendance, RankedCountry, RankedCountryAttendance, RankedCountryDiscipline, RankedDiscipline, RankedUnfiltered, CountryCity, CountryAreaCity } from '../organisations/policies';
|
|
3
3
|
export class SearchIndexabilityManager {
|
|
4
4
|
policies;
|
|
5
5
|
constructor(portalType, seoInfoBase, filterState, sortingState, applicationState) {
|
|
@@ -31,8 +31,6 @@ export class SearchIndexabilityManager {
|
|
|
31
31
|
new RankedCountryAttendance(dependencies),
|
|
32
32
|
new RankedCountryDiscipline(dependencies),
|
|
33
33
|
new RankedDiscipline(dependencies),
|
|
34
|
-
new RankedCountryCity(dependencies),
|
|
35
|
-
new RankedCountryAreaCity(dependencies),
|
|
36
34
|
new RankedUnfiltered(dependencies)
|
|
37
35
|
];
|
|
38
36
|
}
|
|
@@ -18,5 +18,3 @@ export * from './ranked/RankedCountryAttendance';
|
|
|
18
18
|
export * from './ranked/RankedCountryDiscipline';
|
|
19
19
|
export * from './ranked/RankedDiscipline';
|
|
20
20
|
export * from './ranked/RankedUnfiltered';
|
|
21
|
-
export * from './ranked/RankedCountryCity';
|
|
22
|
-
export * from './ranked/RankedCountryAreaCity';
|
|
@@ -18,5 +18,3 @@ export * from './ranked/RankedCountryAttendance';
|
|
|
18
18
|
export * from './ranked/RankedCountryDiscipline';
|
|
19
19
|
export * from './ranked/RankedDiscipline';
|
|
20
20
|
export * from './ranked/RankedUnfiltered';
|
|
21
|
-
export * from './ranked/RankedCountryCity';
|
|
22
|
-
export * from './ranked/RankedCountryAreaCity';
|
|
@@ -2,6 +2,7 @@ import { MinimumAmountOfResultsRule } from './rules/MinimumAmountOfResultsRule';
|
|
|
2
2
|
import { IndexablePageNumberRule } from './rules/IndexablePageNumberRule';
|
|
3
3
|
import { NotDistanceLearningPortalRule } from './rules/NotDistanceLearningPortalRule';
|
|
4
4
|
import { BaseSeoIndexabilityPolicy } from '../common/policies/BaseSeoIndexabilityPolicy';
|
|
5
|
+
import { FilterKey } from '@studyportals/search-filters/server-side';
|
|
5
6
|
export class ProgrammesBaseIndexabilityPolicy extends BaseSeoIndexabilityPolicy {
|
|
6
7
|
indexablePageNumbers = [1];
|
|
7
8
|
initateBaseRules() {
|
|
@@ -20,6 +21,10 @@ export class ProgrammesBaseIndexabilityPolicy extends BaseSeoIndexabilityPolicy
|
|
|
20
21
|
this.rules.push(atLeastSevenResultsRule, notDistanceLearningPortalRule, indexablePageNumberRule);
|
|
21
22
|
}
|
|
22
23
|
async checkRulesForSitemapWithPageNumber(filterKeyValues, pageNumber) {
|
|
24
|
+
const dependencies = this.dependencies;
|
|
25
|
+
if (!Object.keys(filterKeyValues).some(key => key === FilterKey.EDUCATION_LEVEL)) {
|
|
26
|
+
filterKeyValues[FilterKey.EDUCATION_LEVEL] = [dependencies.portalType];
|
|
27
|
+
}
|
|
23
28
|
for (const rule of this.rules) {
|
|
24
29
|
let result;
|
|
25
30
|
if ('forSitemapGeneratorWithPageNumber' in rule) {
|
|
@@ -1,16 +1,13 @@
|
|
|
1
1
|
import { FilterKey } from '@studyportals/search-filters/server-side';
|
|
2
|
-
import { OnlyFiltersSelectedRule } from '../../common/rules/OnlyFiltersSelectedRule';
|
|
3
|
-
import { SingleValueSelectedForFilterRule } from '../../common/rules/SingleValueSelectedForFilterRule';
|
|
4
2
|
import { FilterCombinations } from '../../enums/FilterCombinations';
|
|
5
3
|
import { ProgrammesBaseIndexabilityPolicy } from '../ProgrammesBaseIndexabilityPolicy';
|
|
6
4
|
import { IProgrammeSeoDependencies } from '../types/IProgrammeSeoDependencies';
|
|
7
|
-
import {
|
|
8
|
-
import { BlendedOrOnlineAttendanceRule } from '../rules/BlendedOrOnlineAttendanceRule';
|
|
5
|
+
import { IRule } from '../../common/IRule';
|
|
9
6
|
export declare class AttendanceDegree extends ProgrammesBaseIndexabilityPolicy {
|
|
10
7
|
readonly name: string;
|
|
11
8
|
readonly description: string;
|
|
12
9
|
readonly filterKeys: FilterKey[];
|
|
13
|
-
protected readonly rules:
|
|
10
|
+
protected readonly rules: IRule[];
|
|
14
11
|
constructor(dependencies: IProgrammeSeoDependencies);
|
|
15
12
|
protected generateUrls(): Promise<string[]>;
|
|
16
13
|
get filterCombination(): FilterCombinations;
|
|
@@ -11,15 +11,19 @@ export class AttendanceDegree extends ProgrammesBaseIndexabilityPolicy {
|
|
|
11
11
|
name = 'Attendance Degree Type Policy';
|
|
12
12
|
description = 'Determines indexing rules for pages filtered by both study format (online, blended, on-campus, etc.), and degree type prioritizing degrees and formats with demonstrated search demand.';
|
|
13
13
|
filterKeys = [FilterKey.DELIVERY_METHOD, FilterKey.DEGREE_TYPE];
|
|
14
|
-
rules
|
|
15
|
-
new SingleValueSelectedForFilterRule(FilterKey.DELIVERY_METHOD),
|
|
16
|
-
new SingleValueSelectedForFilterRule(FilterKey.DEGREE_TYPE),
|
|
17
|
-
new OnlyFiltersSelectedRule([FilterKey.DELIVERY_METHOD, FilterKey.DEGREE_TYPE]),
|
|
18
|
-
new IndexableDegreeRule(),
|
|
19
|
-
new BlendedOrOnlineAttendanceRule()
|
|
20
|
-
];
|
|
14
|
+
rules;
|
|
21
15
|
constructor(dependencies) {
|
|
22
16
|
super(dependencies);
|
|
17
|
+
const portalType = this.isSitemapUrlGeneratorDependencies()
|
|
18
|
+
? dependencies.portalType
|
|
19
|
+
: undefined;
|
|
20
|
+
this.rules = [
|
|
21
|
+
new SingleValueSelectedForFilterRule(FilterKey.DELIVERY_METHOD),
|
|
22
|
+
new SingleValueSelectedForFilterRule(FilterKey.DEGREE_TYPE),
|
|
23
|
+
new OnlyFiltersSelectedRule([FilterKey.DELIVERY_METHOD, FilterKey.DEGREE_TYPE]),
|
|
24
|
+
new IndexableDegreeRule(portalType),
|
|
25
|
+
new BlendedOrOnlineAttendanceRule()
|
|
26
|
+
];
|
|
23
27
|
this.initateBaseRules();
|
|
24
28
|
}
|
|
25
29
|
async generateUrls() {
|
|
@@ -10,7 +10,7 @@ import { AttendancePresenter } from '../../presenters/AttendancePresenter';
|
|
|
10
10
|
import { DegreePresenter } from '../../presenters/DegreePresenter';
|
|
11
11
|
export class CountryAttendanceDegree extends ProgrammesBaseIndexabilityPolicy {
|
|
12
12
|
name = 'Country Attendance Degree Policy';
|
|
13
|
-
description = `Determines indexing rules for pages filtered by country,
|
|
13
|
+
description = `Determines indexing rules for pages filtered by country,
|
|
14
14
|
study format (online, on-campus, etc.), and degree type.`;
|
|
15
15
|
filterKeys = [FilterKey.COUNTRY, FilterKey.DELIVERY_METHOD, FilterKey.DEGREE_TYPE];
|
|
16
16
|
rules = [
|
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
import { FilterKey } from '@studyportals/search-filters/server-side';
|
|
2
|
-
import { OnlyFiltersSelectedRule } from '../../common/rules/OnlyFiltersSelectedRule';
|
|
3
|
-
import { SingleValueSelectedForFilterRule } from '../../common/rules/SingleValueSelectedForFilterRule';
|
|
4
2
|
import { FilterCombinations } from '../../enums/FilterCombinations';
|
|
5
|
-
import { IndexableDegreeRule } from '../rules/IndexableDegreeRule';
|
|
6
3
|
import { ProgrammesBaseIndexabilityPolicy } from '../ProgrammesBaseIndexabilityPolicy';
|
|
7
4
|
import { IProgrammeSeoDependencies } from '../types/IProgrammeSeoDependencies';
|
|
5
|
+
import { IRule } from '../../common/IRule';
|
|
8
6
|
export declare class CountryDegree extends ProgrammesBaseIndexabilityPolicy {
|
|
9
7
|
readonly name: string;
|
|
10
8
|
readonly description: string;
|
|
11
9
|
readonly filterKeys: FilterKey[];
|
|
12
|
-
protected readonly rules:
|
|
10
|
+
protected readonly rules: IRule[];
|
|
13
11
|
constructor(dependencies: IProgrammeSeoDependencies);
|
|
14
12
|
protected generateUrls(): Promise<string[]>;
|
|
15
13
|
get filterCombination(): FilterCombinations;
|
|
@@ -10,14 +10,18 @@ export class CountryDegree extends ProgrammesBaseIndexabilityPolicy {
|
|
|
10
10
|
name = 'Country Degree Policy';
|
|
11
11
|
description = 'Determines indexing rules for pages filtered by both country, and degree type.';
|
|
12
12
|
filterKeys = [FilterKey.COUNTRY, FilterKey.DEGREE_TYPE];
|
|
13
|
-
rules
|
|
14
|
-
new SingleValueSelectedForFilterRule(FilterKey.COUNTRY),
|
|
15
|
-
new SingleValueSelectedForFilterRule(FilterKey.DEGREE_TYPE),
|
|
16
|
-
new OnlyFiltersSelectedRule([FilterKey.COUNTRY, FilterKey.DEGREE_TYPE]),
|
|
17
|
-
new IndexableDegreeRule()
|
|
18
|
-
];
|
|
13
|
+
rules;
|
|
19
14
|
constructor(dependencies) {
|
|
20
15
|
super(dependencies);
|
|
16
|
+
const portalType = this.isSitemapUrlGeneratorDependencies()
|
|
17
|
+
? dependencies.portalType
|
|
18
|
+
: undefined;
|
|
19
|
+
this.rules = [
|
|
20
|
+
new SingleValueSelectedForFilterRule(FilterKey.COUNTRY),
|
|
21
|
+
new SingleValueSelectedForFilterRule(FilterKey.DEGREE_TYPE),
|
|
22
|
+
new OnlyFiltersSelectedRule([FilterKey.COUNTRY, FilterKey.DEGREE_TYPE]),
|
|
23
|
+
new IndexableDegreeRule(portalType)
|
|
24
|
+
];
|
|
21
25
|
this.initateBaseRules();
|
|
22
26
|
}
|
|
23
27
|
async generateUrls() {
|
|
@@ -10,7 +10,7 @@ import { DegreePresenter } from '../../presenters/DegreePresenter';
|
|
|
10
10
|
import { DurationPresenter } from '../../presenters/DurationPresenter';
|
|
11
11
|
export class CountryDurationDegree extends ProgrammesBaseIndexabilityPolicy {
|
|
12
12
|
name = 'Country Duration Degree Policy';
|
|
13
|
-
description = `Determines indexing rules for pages filtered by country,
|
|
13
|
+
description = `Determines indexing rules for pages filtered by country,
|
|
14
14
|
duration (1 year, 2 years, etc.), and degree type.`;
|
|
15
15
|
filterKeys = [FilterKey.COUNTRY, FilterKey.DURATION, FilterKey.DEGREE_TYPE];
|
|
16
16
|
rules = [
|
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
import { FilterKey } from '@studyportals/search-filters/server-side';
|
|
2
|
-
import { OnlyFiltersSelectedRule } from '../../common/rules/OnlyFiltersSelectedRule';
|
|
3
|
-
import { SingleValueSelectedForFilterRule } from '../../common/rules/SingleValueSelectedForFilterRule';
|
|
4
2
|
import { FilterCombinations } from '../../enums/FilterCombinations';
|
|
5
|
-
import { IndexableEducationalFormRule } from '../rules/IndexableEducationalFormRule';
|
|
6
3
|
import { ProgrammesBaseIndexabilityPolicy } from '../ProgrammesBaseIndexabilityPolicy';
|
|
7
4
|
import { IProgrammeSeoDependencies } from '../types/IProgrammeSeoDependencies';
|
|
5
|
+
import { IRule } from '../../common/IRule';
|
|
8
6
|
export declare class CountryEducationalForm extends ProgrammesBaseIndexabilityPolicy {
|
|
9
7
|
readonly name: string;
|
|
10
8
|
readonly description: string;
|
|
11
9
|
readonly filterKeys: FilterKey[];
|
|
12
|
-
protected readonly rules:
|
|
10
|
+
protected readonly rules: IRule[];
|
|
13
11
|
constructor(dependencies: IProgrammeSeoDependencies);
|
|
14
12
|
protected generateUrls(): Promise<string[]>;
|
|
15
13
|
get filterCombination(): FilterCombinations;
|
|
@@ -8,17 +8,21 @@ import { CountryPresenter } from '../../presenters/CountryPresenter';
|
|
|
8
8
|
import { EducationalFormPresenter } from '../../presenters/EducationalFormPresenter';
|
|
9
9
|
export class CountryEducationalForm extends ProgrammesBaseIndexabilityPolicy {
|
|
10
10
|
name = 'Country Educational Form Policy';
|
|
11
|
-
description = `Determines indexing rules for pages filtered by both country,
|
|
11
|
+
description = `Determines indexing rules for pages filtered by both country,
|
|
12
12
|
and educational form (academic, semester, summer school, etc.).`;
|
|
13
13
|
filterKeys = [FilterKey.COUNTRY, FilterKey.EDUCATIONAL_FORM];
|
|
14
|
-
rules
|
|
15
|
-
new SingleValueSelectedForFilterRule(FilterKey.COUNTRY),
|
|
16
|
-
new SingleValueSelectedForFilterRule(FilterKey.EDUCATIONAL_FORM),
|
|
17
|
-
new OnlyFiltersSelectedRule([FilterKey.COUNTRY, FilterKey.EDUCATIONAL_FORM]),
|
|
18
|
-
new IndexableEducationalFormRule()
|
|
19
|
-
];
|
|
14
|
+
rules;
|
|
20
15
|
constructor(dependencies) {
|
|
21
16
|
super(dependencies);
|
|
17
|
+
const portalType = this.isSitemapUrlGeneratorDependencies()
|
|
18
|
+
? dependencies.portalType
|
|
19
|
+
: undefined;
|
|
20
|
+
this.rules = [
|
|
21
|
+
new SingleValueSelectedForFilterRule(FilterKey.COUNTRY),
|
|
22
|
+
new SingleValueSelectedForFilterRule(FilterKey.EDUCATIONAL_FORM),
|
|
23
|
+
new OnlyFiltersSelectedRule([FilterKey.COUNTRY, FilterKey.EDUCATIONAL_FORM]),
|
|
24
|
+
new IndexableEducationalFormRule(portalType)
|
|
25
|
+
];
|
|
22
26
|
this.initateBaseRules();
|
|
23
27
|
}
|
|
24
28
|
async generateUrls() {
|
|
@@ -1,17 +1,13 @@
|
|
|
1
1
|
import { FilterKey } from '@studyportals/search-filters/server-side';
|
|
2
|
-
import { OnlyFiltersSelectedRule } from '../../common/rules/OnlyFiltersSelectedRule';
|
|
3
|
-
import { SingleValueSelectedForFilterRule } from '../../common/rules/SingleValueSelectedForFilterRule';
|
|
4
2
|
import { FilterCombinations } from '../../enums/FilterCombinations';
|
|
5
3
|
import { ProgrammesBaseIndexabilityPolicy } from '../ProgrammesBaseIndexabilityPolicy';
|
|
6
4
|
import { IProgrammeSeoDependencies } from '../types/IProgrammeSeoDependencies';
|
|
7
|
-
import {
|
|
8
|
-
import { IndexableDegreeRule } from '../rules/IndexableDegreeRule';
|
|
9
|
-
import { AffordableTuitionFeeRule } from '../rules/AffordableTuitionFeeRule';
|
|
5
|
+
import { IRule } from '../../common/IRule';
|
|
10
6
|
export declare class DegreeAttendanceTuitionFee extends ProgrammesBaseIndexabilityPolicy {
|
|
11
7
|
readonly name: string;
|
|
12
8
|
readonly description: string;
|
|
13
9
|
readonly filterKeys: FilterKey[];
|
|
14
|
-
protected readonly rules:
|
|
10
|
+
protected readonly rules: IRule[];
|
|
15
11
|
constructor(dependencies: IProgrammeSeoDependencies);
|
|
16
12
|
protected generateUrls(): Promise<string[]>;
|
|
17
13
|
get filterCombination(): FilterCombinations;
|
|
@@ -14,17 +14,21 @@ export class DegreeAttendanceTuitionFee extends ProgrammesBaseIndexabilityPolicy
|
|
|
14
14
|
name = 'Tuition Fee Attendance Degree Policy';
|
|
15
15
|
description = 'Determines indexing rules for pages filtered by tuition fee, attendance, and degree type.';
|
|
16
16
|
filterKeys = [FilterKey.TUITION_FEE, FilterKey.DELIVERY_METHOD, FilterKey.DEGREE_TYPE];
|
|
17
|
-
rules
|
|
18
|
-
new SingleValueSelectedForFilterRule(FilterKey.DEGREE_TYPE),
|
|
19
|
-
new SingleValueSelectedForFilterRule(FilterKey.DELIVERY_METHOD),
|
|
20
|
-
new SingleValueSelectedForFilterRule(FilterKey.TUITION_FEE),
|
|
21
|
-
new OnlyFiltersSelectedRule([FilterKey.DEGREE_TYPE, FilterKey.DELIVERY_METHOD, FilterKey.TUITION_FEE]),
|
|
22
|
-
new IndexableDegreeRule(),
|
|
23
|
-
new OnlineAttendanceRule(),
|
|
24
|
-
new AffordableTuitionFeeRule()
|
|
25
|
-
];
|
|
17
|
+
rules;
|
|
26
18
|
constructor(dependencies) {
|
|
27
19
|
super(dependencies);
|
|
20
|
+
const portalType = this.isSitemapUrlGeneratorDependencies()
|
|
21
|
+
? dependencies.portalType
|
|
22
|
+
: undefined;
|
|
23
|
+
this.rules = [
|
|
24
|
+
new SingleValueSelectedForFilterRule(FilterKey.DEGREE_TYPE),
|
|
25
|
+
new SingleValueSelectedForFilterRule(FilterKey.DELIVERY_METHOD),
|
|
26
|
+
new SingleValueSelectedForFilterRule(FilterKey.TUITION_FEE),
|
|
27
|
+
new OnlyFiltersSelectedRule([FilterKey.DEGREE_TYPE, FilterKey.DELIVERY_METHOD, FilterKey.TUITION_FEE]),
|
|
28
|
+
new IndexableDegreeRule(portalType),
|
|
29
|
+
new OnlineAttendanceRule(),
|
|
30
|
+
new AffordableTuitionFeeRule()
|
|
31
|
+
];
|
|
28
32
|
this.initateBaseRules();
|
|
29
33
|
}
|
|
30
34
|
async generateUrls() {
|