Skip to content

Commit 248af58

Browse files
committed
feat: add ConfigurationService for retrieving parametric filter fields and update DahService with MaxResults parameter
1 parent 31aa653 commit 248af58

File tree

4 files changed

+87
-0
lines changed

4 files changed

+87
-0
lines changed

src/app/services/dah.service.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ export class DahService {
4444
.set('storestate', 'true')
4545
.set('StoredStateTokenLifetime', '-1')
4646
.set('print', 'NoResults')
47+
.set('MaxResults', '100')
4748
.set('responseformat', 'simplejson');
4849

4950
return this.http.get<StoreStateResponse>(this.dahUrl, { params }).pipe(
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { TestBed } from '@angular/core/testing';
2+
3+
import { ParametricConfigurationService } from './parametric.configuration.service';
4+
5+
describe('ParametricConfigurationService', () => {
6+
let service: ParametricConfigurationService;
7+
8+
beforeEach(() => {
9+
TestBed.configureTestingModule({});
10+
service = TestBed.inject(ParametricConfigurationService);
11+
});
12+
13+
it('should be created', () => {
14+
expect(service).toBeTruthy();
15+
});
16+
});
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
import { Injectable } from '@angular/core';
2+
import { HttpClient, HttpParams } from '@angular/common/http';
3+
import { Observable } from 'rxjs';
4+
5+
export interface IdolFieldResult {
6+
FILTER_FIELD_NAME?: string;
7+
FILTER_FIELD_DISPLAY_NAME?: string;
8+
}
9+
10+
export interface IdolResponse {
11+
autnresponse: {
12+
response: string;
13+
responsedata: {
14+
hit: {
15+
document: {
16+
FILTER_FIELD_NAME?: string[];
17+
FILTER_FIELD_DISPLAY_NAME?: string[];
18+
};
19+
}[];
20+
};
21+
};
22+
}
23+
24+
@Injectable({
25+
providedIn: 'root'
26+
})
27+
export class ConfigurationService {
28+
private baseUrl = 'api/configure';
29+
30+
constructor(private http: HttpClient) {}
31+
32+
/**
33+
* Retrieves parametric filters (FILTER_FIELD_NAME and DISPLAY_NAME)
34+
* from IDOL Content Engine using a text query.
35+
* @param textQuery Query string, e.g. "*" or "PROFILE_NAME:engineering_jobs"
36+
*/
37+
getParametricFilterFields(textQuery: string = '*'): Observable<IdolFieldResult[]> {
38+
const params = new HttpParams()
39+
.set('action', 'query')
40+
.set('text', textQuery)
41+
.set('fieldname', 'FILTER_FIELD_NAME,FILTER_FIELD_DISPLAY_NAME')
42+
.set('maxresults', '100')
43+
.set('outputencoding', 'utf8')
44+
.set('FieldText', 'MATCH{True}:IS_ACTIVE')
45+
.set('print', 'all');
46+
47+
return new Observable(observer => {
48+
this.http.get<IdolResponse>(this.baseUrl, { params }).subscribe({
49+
next: (response) => {
50+
const docs = response?.autnresponse?.responsedata?.hit || [];
51+
const fields = docs.map(hit => ({
52+
FILTER_FIELD_NAME: hit.document.FILTER_FIELD_NAME?.[0],
53+
FILTER_FIELD_DISPLAY_NAME: hit.document.FILTER_FIELD_DISPLAY_NAME?.[0]
54+
}));
55+
observer.next(fields);
56+
observer.complete();
57+
},
58+
error: (err) => observer.error(err)
59+
});
60+
});
61+
}
62+
}

src/proxy.conf.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
const { LogLevel } = require("@angular/compiler-cli");
2+
13
module.exports = {
24
"/api/answerserver": {
35
target: "https://answerserver.idoldemos.net:12000",
@@ -27,6 +29,12 @@ module.exports = {
2729
changeOrigin: true,
2830
logLevel: "debug"
2931
},
32+
"api/configure": {
33+
target : "https://content3.idoldemos.net:9400",
34+
secure: false,
35+
LogLevel: "debug",
36+
pathRewrite: { "^/api/configure": "" }
37+
},
3038
"/api/dah": {
3139
target: "https://dah.idoldemos.net:9060",
3240
secure: false,

0 commit comments

Comments
 (0)