diff --git a/typescript/api/services/VocabService.ts b/typescript/api/services/VocabService.ts index b2bddd0c0..a723fbf47 100644 --- a/typescript/api/services/VocabService.ts +++ b/typescript/api/services/VocabService.ts @@ -168,7 +168,7 @@ export module Services { return dbResults; } } else if (queryConfig.querySource == 'solr') { - let solrQuery = this.buildSolrParams(brand, searchString, queryConfig, start, rows, 'json'); + let solrQuery = this.buildSolrParams(brand, searchString, queryConfig, start, rows, 'json',user); let solrResults = await this.getSearchService().searchAdvanced(queryConfig.searchQuery.searchCore, null, solrQuery); if(queryConfig.resultObjectMapping) { return this.getResultObjectMappings(solrResults,queryConfig); @@ -185,13 +185,13 @@ export module Services { } if (queryConfig.userQueryFields != null) { for(let userQueryField of queryConfig.userQueryFields) { - paramMap[userQueryField.property] = _.get(user,userQueryField.userValueProperty, null); + paramMap[userQueryField.property] = _.get(user, userQueryField.userValueProperty, null); } } return paramMap; } - private buildSolrParams(brand:BrandingModel, searchString:string, queryConfig:VocabQueryConfig, start:number, rows:number, format:string = 'json'):string { + private buildSolrParams(brand:BrandingModel, searchString:string, queryConfig:VocabQueryConfig, start:number, rows:number, format:string = 'json',user):string { let query = `${queryConfig.searchQuery.baseQuery}&sort=date_object_modified desc&version=2.2&start=${start}&rows=${rows}`; query = query + `&fq=metaMetadata_brandId:${brand.id}&wt=${format}`; @@ -208,6 +208,13 @@ export module Services { } } + if (queryConfig.userQueryFields != null) { + for(let userQueryField of queryConfig.userQueryFields) { + let searchProperty = queryConfig.queryField.property; + query = query + '&fq=' + searchProperty + ':'+ _.get(user, userQueryField.userValueProperty, null); + } + } + return query; }