Configuration Item Tag and Keyword Search
Configuration Item Tag and Keyword Search
Define and enable CI search for related keywords within global text search
Usually, CMDBs are so large and over-stuffed with so many configuration items that users face the challenge of effectively searching for CIs. If a CI exists but is not found, a user may decide to create a new CI which can lead to unnecessary duplication over time. One way to help mitigate the risk of CI duplication is to implement a more robust search functionality.
This article will explain in depth how to configure global search to leverage tags so that your users can easily find what they are looking for. The following examples illustrate how to set up auto-tagging of records and how to leverage tags with global search for records on the cmdb_ci_computer table.
If you'd like to brush up on your tag basics, head over to this article which goes over the fundamentals of tagging.
First, we'll add the table(s) we want our global search to query by defining search groups.
Navigate to System Definition > Search Groups and click New. Give your search group a descriptive name.
In this example:
Name: CMDB Computers
Description: CMDB Computers
Active: true
Searched: true
After saving the record, you should see the Text Search Tables related list at the bottom of the screen. Click the New button to create a new Text Search Table record and fill out and submit the form.
Search Group: CMDB Computers
Table: Computer
Active: true
Searched: true
You should have been taken back to the Search Group record, which should now look like this:
The Search Group we just created should now show up on the global search results. If we were to stop here, our search would be limited to exact matches only.
**Note: If you're happy with this functionality and would like to stop here, make sure to re-index your table. To do this, navigate to System Definition > Dictionary and search for the Collection record for your table and click the Generate Text Index related link.
Now we are going to text index tags on our table so global search can query our tags.
Staying on the same dictionary collection record, find the Attributes related list and click the New button. Fill in the following and then submit:
Attribute: Text Index Tags
Value: all_shared
We've just told the system to index all shared tags. Keep in mind private tags will not be indexed.
Now it's time to create our tags. Navigate to System Definition > Tags and create a new record.
In this example:
Name: Laptop
Owner:
Type: Standard
Viewable by: Everyone
Active: true
Save your tag record.
To proceed to the next step, we will have to add the Conditions for Labels embedded list to the form:
Create a new record in the Conditions for Labels embedded list by double clicking Insert a new row and then clicking on the magnifying glass > New. Fill out the Label Table form and then submit.
In this example:
Title: cmdb_ci_computer synonyms
Table: Computer
What we've done here is we've told the system to apply this tag automatically to the records in the cmdb_ci_computer table. Since I did not specify any conditions, it will apply the tag to all records in the cmdb_ci_computer table. You can verify your tags were successfully applied from the Label Entries related list.
Let's go ahead and re-index the table to ensure our tags are captured in the global search results.
**Note: To get to the dictionary entry, navigate to System Definition > Dictionary and search for the Collection record for your table and click the Generate Text Index related link.
Finally, try searching for your tag keyword in the global search bar.
You should now see the query results returning records where the search term matched your tag.
A handy feature that comes with implementing tags this way is that you can add multiple keywords to each tag. You can create a tag and stuff as many keywords in the Name field as you want. You may have to increase the max length if you want to add more than 40 characters. (Just be aware of any performance hits your instance may take because of extra long tags).
For example, I created a tag with the name "smart intelligent device tablet laptop windows 10 2000 xp vista". Now, each one of those terms is searchable through the global search as long as that tag is associated to a record.
OK, onto the exciting stuff! The global text search leverages the Zing search engine to make sense of search terms and return query results. Let's take a look at how the Zing search engine handles a few different scenarios when it comes to tags.
The first batch of tests I performed was on a tag I created that had two keywords in it: smart device.
I performed a few different scenarios which you'll see below by searching for different combinations in the global search. The results are only those records which were returned in the CMDB Computer search group which we defined earlier in this article.
Scenario 1:
Global search term: smart device
Result: 850 returned records
Explanation: Searching for the full tag, even with a space between the two words, matches all 811 records with "smart device" tags.
Scenario 2:
Global search term: smartdevice
Result: 0 returned records
Explanation: Zing was not able to match the search term with the "smart device" tag. This tells me Zing delimits search terms, at least by spaces.
Scenario 3:
Global search term: smart,device
Result: 850 returned records
Explanation: Zing must also delimit by commas.
Scenario 4:
Global search term: device smart
Result: 850 returned records
Explanation: Further evidence that terms are parsed and delimited as searches can contain terms in any order and will return records with matching tags as long as all terms are found within that tag.
Scenario 5:
Global search term: smart
Result: 850 returned records
Explanation: It makes sense that searching for a single term would still return all records if Zing delimits the separate terms in the tag.
Scenario 6:
Global search term: device
Result: 850 returned records
Explanation: Same as scenario 4.
Scenario 7:
Global search term: smar
Result: 0 returned records
Explanation: Zing does not handle misspellings.
Scenario 8:
Global search term: windows device
Result: 364 returned records
Explanation: Records with the smart device tag were not successfully returned. However, there were still results because windows and/or device were terms found in the actual record data. This, along with scenario 4, leads me to believe that for tags, the system must match all search terms to terms found within tags. If it does not find even one search term in the tags for a given record, it will not return it in the results set. I performed an additional test for this which I will include here where I created another tag called windows and re-indexed the table. After doing this, the search term windows device returned all 850 records. So my conclusion based on this is that the search terms are delimited and the system attempts to match each term to a term found in all tags on a given record.
For actual record data (ie. field values on the form), I noticed a trend where only one of the search terms needed to match with the record data. For example, the system could match the search term windows within the record data, but not device, and still return that record in its result set.
Let us know if there’s anything we missed or you would like us to expand upon in the comments! Don't forget to subscribe!
At the time of this writing, we are on the Madrid release. The information presented in this article may not apply to your instance if you are on a different version of ServiceNow.
Read the full article