Knowledge Base Advanced Filters
Another possible search mode, which can be added to the previous ones, is the category filter.
The correspondence of the category set in the Service Operation is evaluated, with the one chosen instead in the article of the KB.
To configure this filter, you need to change the configuration of the custom field, type Kbtips, which offers the articles in the form.
CATEGORY FILTER – GUIDE
1 – Go to the System > custom Fields section of the Deepser backend and select the Deepservice – Operation model.
2 – Click on the Fields tab and on a Kbtips type field (eg Knowledge Base) to access the configuration form.
![](https://docs.deepser.com/wp-content/uploads/2023/11/Knowledge-Base-Advanced-Filters.png)
3 – Add the following php code to the custom element scripting area and click the Apply button at the top right.
![](https://docs.deepser.com/wp-content/uploads/2023/11/Advaced-Filters-KB.jpg)
$element['fire_search'] = true;
$currentOperation = Deep::registry("current_model_instance");
if($currentOperation->getCategory1()){
$filters = [];
$filters[] = [
'field' => 'category1',
'value' => $currentOperation->getCategory1(),
'condition' => 'eq',
];
if($currentOperation->getCategory2()){
$filters[] = [
'field' => 'category2',
'value' => $currentOperation->getCategory2(),
'condition' => 'eq',
];
}
if($currentOperation->getCategory3()){
$filters[] = [
'field' => 'category3',
'value' => $currentOperation->getCategory3(),
'condition' => 'eq',
];
}
$element['filters'] = $filters;
}
Now the articles will be filtered based on the correspondence between categories set in the Operation and those set in the article.
Notes:
- Items without category are always proposed, but not having positive matches in the comparison between categories will penalize them in the order with which they are proposed.
- If in the ticket I have selected only Category 1 = CATEGORY A’, then all the articles that have as Category 1 = CATEGORY A’ in the following order will be displayed: first those with the only Category 1 valued, then the others with any Category 2, Category 3 and finally those without any assigned category.
- If in the ticket I have selected Category 1 = Category A’ and Category 2 = Category B’ then all the articles that have as Category 1 = Category A’ and Category 2 = Category B’ will be displayed in the following order: first those with Category 1 and Category 2, then possible with Category 3 and finally those without assigned category.