Revision 44262
Added by Argiro Kokogiannaki over 7 years ago
searchProjects.service.ts | ||
---|---|---|
3 | 3 |
import {Observable} from 'rxjs/Observable'; |
4 | 4 |
import {OpenaireProperties} from '../utils/properties/openaireProperties'; |
5 | 5 |
import {SearchResult} from '../utils/entities/searchResult'; |
6 |
// import {RefineParsingUtils} from './services-utils/refineResults.class';
|
|
6 |
import {RefineResultsUtils} from './servicesUtils/refineResults.class';
|
|
7 | 7 |
|
8 | 8 |
@Injectable() |
9 | 9 |
export class SearchProjectsService { |
... | ... | |
11 | 11 |
|
12 | 12 |
constructor(private http: Http) {} |
13 | 13 |
|
14 |
searchProjects (params: string, page: number, size: number):any { |
|
14 |
searchProjects (params: string, page: number, size: number, refineFields:string[] ):any {
|
|
15 | 15 |
|
16 | 16 |
console.info("In searchProjects"); |
17 | 17 |
|
... | ... | |
19 | 19 |
|
20 | 20 |
let url = link+"?"; |
21 | 21 |
if(params != '') { |
22 |
url += "q="+params+"&page="+page+"&size="+size;
|
|
22 |
url += params+"&page="+page+"&size="+size; |
|
23 | 23 |
} else { |
24 | 24 |
url += "page="+page+"&size="+size; |
25 | 25 |
} |
... | ... | |
27 | 27 |
return this.http.get(url) |
28 | 28 |
.map(res => <any> res.json()) |
29 | 29 |
//.do(res => console.info(res)) |
30 |
.map(res => [res['meta'].total, this.parseResults(res['results'])]) |
|
31 |
; |
|
30 |
.map(res => [res['meta'].total, this.parseResults(res['results']),RefineResultsUtils.parse(res['refineResults'],refineFields)]); |
|
32 | 31 |
} |
33 | 32 |
|
34 | 33 |
|
Also available in: Unified diff
In Projects search component and search PAge: create the proper query using url parameters, mark as checked the proper filters after getting the results from search, apply changes in other components so they can work too.