/** * Copyright since 2025 Mifos Initiative * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /** Angular Imports */ import { Injectable, inject } from '@angular/core'; import { HttpClient, HttpParams } from '@angular/common/http'; /** rxjs Imports */ import { Observable } from 'rxjs'; /** * Search service. */ @Injectable({ providedIn: 'root' }) export class SearchService { private http = inject(HttpClient); /** * @param {string} query Query String * @param {string} resource Entity resource * @returns {Observable} Search Results. */ getSearchResults(query: string, resource: string): Observable { const httpParams = new HttpParams().set('exactMatch', 'false').set('query', query).set('resource', resource); return this.http.get('/search', { params: httpParams }); } }