Project

General

Profile

« Previous | Next » 

Revision 58863

[Connect | Trunk]: Use method containsWord for search keyword on search communities

View differences:

searchCommunities.component.ts
176 176
   * @param params, status
177 177
   * @private
178 178
   */
179
  private _getResults(params: Map<string, string>) {
179
  private _getResults(params) {
180 180
    this.searchUtils.status = this.errorCodes.LOADING;
181 181
    this.disableForms = true;
182 182
    this.results = this.totalResults;
......
227 227
    this.sort();
228 228
    this.searchUtils.totalResults = this.results.length;
229 229
    this.searchPage.prepareFiltersToShow(this.filters, this.searchUtils.totalResults);
230
    
231 230
    this.results = this.results.slice((this.searchUtils.page - 1) * this.searchUtils.size, (this.searchUtils.page * this.searchUtils.size));
232 231
    this.searchUtils.status = this.errorCodes.DONE;
233 232
    if (this.searchUtils.totalResults == 0) {
......
245 244
        this.searchUtils.status = this.errorCodes.OUT_OF_BOUND;
246 245
      }
247 246
    }
248
    HelperFunctions.scroll();
249 247
  }
250 248
  
251 249
  
......
259 257
    for (let i = 0; i < this.results.length; i++) {
260 258
      for (let keyword of keywords) {
261 259
        keyword = keyword.toLowerCase();
262
        if (keyword != '' && (this.results[i].title.toLowerCase().includes(keyword) || this.results[i].shortTitle.toLowerCase().includes(keyword) ||
263
          this.results[i].communityId.toLowerCase().includes(keyword) || this.results[i].description.toLowerCase().includes(keyword))) {
260
        if (keyword != '' && (StringUtils.containsWord(this.results[i].title, keyword) || StringUtils.containsWord(this.results[i].shortTitle, keyword) ||
261
          StringUtils.containsWord(this.results[i].communityId, keyword) || StringUtils.containsWord(this.results[i].description, keyword))) {
264 262
          ret.push(this.results[i]);
265 263
          break;
266 264
        }
......
275 273
   *
276 274
   * @param params
277 275
   */
278
  private checkFilters(params: Map<string, string>) {
276
  private checkFilters(params) {
279 277
    let typeResults: CommunityInfo[] = this.applyFilter('type', params);
280 278
    let statusResults: CommunityInfo[] = this.results;
281 279
    let roleResults: CommunityInfo[] = this.results;
......
312 310
  private applyFilter(filterId: string, params): CommunityInfo[] {
313 311
    let results: CommunityInfo[] = [];
314 312
    let values: string[] = [];
315
    if (params[filterId] != undefined) {
313
    if (params[filterId]) {
316 314
      values = (StringUtils.URIDecode(params[filterId])).split(/,(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/, -1);
317 315
    }
318 316
    if (filterId == 'type') {

Also available in: Unified diff