Skip to main content

Id Lookup

Sometimes it is neccessary to resolve some entities by id at query time. To use this feature you need admin access to the qsc plattform, because you need to change the search pipeline. Ask you administrator for more details.

Configurations

For the id lookup some complex configurations have to be done.

parametersexampledescription
ParallelFilter.idparallelIdLookupFilterTagsA unique id for the parallel filter. Pattern parallelIdLookupFilter$Entity
ParallelFilter.pipelines.idtagLookupPipelineA unique id for the lookup pipeline filter.
ElasticFilter.baseUrl{{ searchIndexUrl }}/{{ env }}.{{ tenant }}.tagsThe elasticsearch base url
ElasticFilter.resultSetIdlookupTagsThe result set id where the looked up entites are stored in the pipeline container. Pattern: lookup$Entity
ElasticFilter.queryTransformer.profiledeprecateddeprecated
ElasticFilter.queryTransformer.searchResultId{{searchCode}}The result set from where the ids must be extracted
ElasticFilter.queryTransformer.idFieldssport_type_tag_idA list of field ids from where the ids for the lookup are extracted.
ElasticFilter.searchResultTransformer.fieldMapping-Mapping which defines the rquired fields of the entity to display.
QscIdLookupMergingFilter.idqscIdLookupMergingFilterTagsA unique id. Pattern: qscIdLookupMergingFilter$Entity
QscIdLookupMergingFilter.resultSetId{{searchCode}}The id of the result set to which the entities must be merged.
QscIdLookupMergingFilter.lookupResultSetIdlookupTagsThe id of the result set where the entities for merging are available.
QscIdLookupMergingFilter.idMappingssport_type_tag_id->sport_type_tagA mapping from the id to mapped, to id of the field where the mapped entity is stored.
  - !!com.quasiris.qsf.pipeline.filter.ParallelFilter
active: true
id: parallelIdLookupFilterTags
pipelines:
- filterList:
- !!com.quasiris.qsf.pipeline.filter.elastic.ElasticFilter
active: true
baseUrl: "{{ searchIndexUrl }}/{{ env }}.{{ tenant }}.tags"
id: idLookupElasticFilterTags
resultSetId: lookupTags
queryTransformer: !!com.quasiris.qsc.search.service.idlookup.QscIdLookupQueryTransformer
profile: DEPRECATED
searchResultId: {{searchCode}}
idFields:
- sport_type_tag_id
searchResultTransformer: !!com.quasiris.qsf.pipeline.filter.elastic.Elastic2SearchResultMappingTransformer
fieldMapping:
name:
- name
id:
- id
category:
- category
slug:
- slug
- !!com.quasiris.qsc.search.service.idlookup.QscIdLookupMergingFilter
active: true
id: qscIdLookupMergingFilterTags
resultSetId: {{searchCode}}
lookupResultSetId: lookupTags
idMappings:
- sport_type_tag_id->sport_type_tag
id: tagLookupPipeline

How it works

Id Lookup Flow

  • at first a search result is retrieved
  • the QscIdLookupQueryTransformer extract the ids from the configured idField: ["sport_type_tag_id"] in the retrieved search result
  • the values for the extracted ids are retrieved by a elastic search query
  • the index is configured in the baseUrl: {{ searchIndexUrl }}/{{ env }}.{{ tenant }}.tags
{
"result": {
"profiles": {
"documents": [
{
"document": {
"sport_type_tag_id": "9361f47f-2998-4b31-ada9-bf9a3b9dac06",
"name": "A basketball profile"
}
}
]
}
}
}
  • the QscIdLookupMergingFilter merges the retrieved entites from the lookupResultSetId: lookupTags to the resultSetId: {{searchCode}}
  • the sourceId and the target field name are configured in the ``idMappings: sport_type_tag_id->sport_type_tag`
  • the Elastic2SearchResultMappingTransformer map the necessary fields of the entity
fieldMapping:
name:
- name
id:
- id
category:
- category
slug:
- slug

{
"result": {
"profiles": {
"documents": [
{
"document": {
"sport_type_tag_id": "9361f47f-2998-4b31-ada9-bf9a3b9dac06",
"sport_type_tag": {
"name": "Handball",
"id": "9361f47f-2998-4b31-ada9-bf9a3b9dac06",
"category": "SPORT_TYPE",
"slug": "handball"
},
"name": "A handball profile"
}
}
]
}
}
}
  • the filter must be wrapped by a ParallelFilter because QscIdLookupQueryTransformer will stop the pipeline in case no ids were found to resolve