0% found this document useful (0 votes)
53 views

SPF - Configuring Legacy Zing Search in SP

Uploaded by

yecesof333
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
53 views

SPF - Configuring Legacy Zing Search in SP

Uploaded by

yecesof333
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 41

Service Portal Fundamentals

Configuring Legacy Zing Search


in Service Portal

ServiceNow Training and Certification


Service Portal Fundamentals 2
© 2022 ServiceNow, Inc. All Rights Reserved
The ServiceNow® Zing text indexing and search engine is the legacy search engine
used to search Now Platform® record data. Its engine is created entirely
with ServiceNow code and implemented within the relational model.

The ServiceNow® AI Search application provides a modern consumer-grade search


engine for ServiceNow® Service Portal, ServiceNow® Now Mobile,
and ServiceNow® Virtual Agent. Intelligent query features enable users to quickly
find the answers they need.

Refer to Search administration in Product Docs, to learn more about each search
engine.

Service Portal Fundamentals 3


© 2022 ServiceNow, Inc. All Rights Reserved
Service Portal Fundamentals 4
© 2022 ServiceNow, Inc. All Rights Reserved
Review the images on this page. You will notice that when the user enters "excel" in
the Homepage Search Widget Instance on the [index] Page, they are presented
with different results than when they search for the same string in the Typeahead
Search Widget Instance on the [sc_home] Page. The results from the Homepage
Search Widget Instance provide links to Service Catalog items and Knowledge Base
articles, whereas the results from the Typeahead Search Widget Instance only
provide links to Service Catalog items.

The Options of a Typeahead Search Widget Instance include a property to identify


Contextual Search Sources. This controls the search results for that specific Widget
Instance. In the image on the right, Service Catalog is the only Search Source
identified in the Contextual Search Source field, so the search results in this specific
Widget Instance only list Service Catalog items.

The configuration options of a Homepage Search Widget Instance do not include a


property to identify a Contextual Search Source, so the Search Sources identified in
the Portal record are used to control search results for this specific Widget Instance.
In the image on the left, the Service Catalog, Knowledge Base, and Questions and
Answers are the Search Sources identified in the /sp Portal record, so the search
results in this specific Widget Instance would list the matching results from all three
sources.

Service Portal Fundamentals 5


© 2022 ServiceNow, Inc. All Rights Reserved
It is a very common strategy to include the Breadcrumbs and Typeahead Search
Widgets in the first container on Pages not considered homepages.

In this example, the Typeahead Search Widget was placed on the Service Catalog
[sc_home] Page. The value of the Widget Instance’s Contextual Search Sources
property only contains Service Catalog. This means when a search is performed
using this Widget Instance on this Page, search results will only offer matches from
the Service Catalog Search Source.

Service Portal Fundamentals 6


© 2022 ServiceNow, Inc. All Rights Reserved
Service Portal Fundamentals 7
© 2022 ServiceNow, Inc. All Rights Reserved
The Search Sources related list is only visible when AI Search is not enabled.

Service Portal Fundamentals 8


© 2022 ServiceNow, Inc. All Rights Reserved
Search Source form fields:
Name – the user-friendly name of the Search Source.
ID – ID for the Search Source. Must be unique and cannot include any spaces or special characters.
Application – identifies the scope of the Search Source.
Roles – identify roles that can access this Search Source if the Service Portal User Criteria Support
plugin is not enabled.
Search page template – HTML code instructs the search Widget how to render search results. If
defining a basic Search Source, you do not need to change the default template.

Fields on the Data Source tab:


Is scripted source – check to hide table selection fields and display the Data fetch script field.
Table – identify the table containing the records of interest.
Conditions –criteria that must evaluate to true for the record to be included in the Search results.
Primary display field – field to display in search results.
Display Fields – additional fields to display in search results.
Data fetch script – pro-code developers can define an endpoint and use API calls to fetch external
data. This script can fetch data from anywhere on the web.
Facet generation script – pro-code developers can define search facets for a scripted search
source. Enables end users to filter search results for a more meaningful result set.
Paginate results – activating this field adds a Load more results button to the search results page.
This flag automatically enables pagination for simple search sources.

Fields on the Typeahead tab:


Enable typeahead – select this checkmark to enable typeahead functionality. (Enabled by
default.)
Advanced typeahead config – select this checkmark to hide the Typeahead glyph and Page
fields and display the Typeahead template field.
Typeahead template – pro-code developers can script the display of search results.
Typeahead glyph – select a glyph to appear in the search bar to the left of the display field(s).
Page – identify the target Page to display when an element is selected in search results.

Service Portal Fundamentals 9


© 2022 ServiceNow, Inc. All Rights Reserved
Service Portal Fundamentals 10
© 2022 ServiceNow, Inc. All Rights Reserved
The following system properties enable and disable search suggestions:

• glide.search.suggestions.enabled: Set it to true (default) to enable search


suggestions or set it to false to disable search suggestions everywhere.
• glide.service_portal.search_as_you_type_behavior: Select search suggestions or
type-ahead functionality.

User Roles:
• cannot_read_suggestions prevents users from seeing suggestions
• suggestions_exempt role does not create suggestions for a user’s searches

Unauthenticated/Guest users can neither see nor generate suggestions.

The Build Search Suggestions scheduled job is responsible for building suggestions
daily from the analytics captured in the previous day.

If upgrading from a previous release, update and execute the Populate


Suggestions to avoid Cold Start - Portals scheduled job to populate search
suggestions with data from a platform search table. You will need to update this
script as documented in Product Documentation. Alternatively, you can wait until
users search for keywords instead of running this script.

Service Portal Fundamentals 11


© 2022 ServiceNow, Inc. All Rights Reserved
In this example, a Search Source was added to the Portal to include active P1 and
P2 Incident records in the list of search results. This was done in an effort to provide
end users with another way of learning about high priority Incidents.

Service Portal Fundamentals 12


© 2022 ServiceNow, Inc. All Rights Reserved
Select a Search Source on the left to narrow down the returned results on the right.

Service Portal Fundamentals 13


© 2022 ServiceNow, Inc. All Rights Reserved
Service Portal Fundamentals 14
© 2022 ServiceNow, Inc. All Rights Reserved
The Search Page Route Map record redirects users from the search Page to the
sp_search Page when viewing search results in Service Portal. The sp_search page
includes the Faceted Search widget, which supports Search Facets in both desktop
and mobile environments.

Service Portal Fundamentals 15


© 2022 ServiceNow, Inc. All Rights Reserved
Facet form fields:
Name – display name of the facet header.
Application – application scope of the search source. This value is read-only.
Selection type – type of user selection allowed:
• Single: only one filter value can be selected at a time.
• Multiple: multiple filter values can be selected at the same time.
Active – whether the filter option displays in search results.
Use mapped facet filters – maps a facet to a query condition, such as [Updated][After][Last
week].
Order – defines the display order when multiple facets are defined.
Table – table that the query is created for.
Field – field that end users can filter search results by. Only fields of the following types are
supported: True/False, Choice, Decimal, Floating Point Number, Integer, IP Address, Long,
Reference, String, String (Full UTF-8), and URL.
Sort – determines the order in which filter options display. Ascending (default) or Descending.

If Use mapped facet filters is selected, a Facet Filters related list appears on the Facet form.
Define the facet filters by creating new records in this list.

Facet Filter form fields:


Name – display name of the Facet Filter option.
Order – defines the display order when multiple facet filters are defined.
Application – the application scope of the Search Source. This value is read-only.
Facet – the Search Facet that uses the mapped query. This value is read-only.
Table – the table defined in the Search Facet. This value is read-only.
Mapped Query – a query condition that users can set to filter search results. For
example, [Updated][On][Today].

Service Portal Fundamentals 16


© 2022 ServiceNow, Inc. All Rights Reserved
TIP
For Optimal Performance:
• Create Facet items and mapped queries with no more than 30 filter
items. To verify, test each Search Source with a variety of keywords as a
user with low permissions.
• Limit Search Sources when possible to perform only the necessary query.
For example, if a search only needs to return active Incidents, add a
condition to the Search Source set to [Active] [is] [true]. A search that
queries only active Incidents is faster than a search that queries all
records in the Incident table.
• Only set Search Facets for indexed fields.

Service Portal Fundamentals 17


© 2022 ServiceNow, Inc. All Rights Reserved
For advanced search sources, when a user clicks Load more search results, the
search source re-executes the data fetch script.

Note: If paginating a search source with advanced facets, do not modify the facet
generation script to load facets based on the results from each page. Facets
should enable end users to filter results from an entire result set, rather than page-
specific results.

Service Portal Fundamentals 18


© 2022 ServiceNow, Inc. All Rights Reserved
Service Portal Fundamentals 19
© 2022 ServiceNow, Inc. All Rights Reserved
Service Portal Fundamentals 20
© 2022 ServiceNow, Inc. All Rights Reserved
The glide.service_portal.default_search_sources System Property Value is a comma-separated
array of sys_ids. The Baseline Value field includes the sys_id's for the following
sp_search_source records:
• Knowledge
• Service Catalog
• Questions and Answers

System Administrators can update this System Property to add or delete default Search Sources.

To add a sys_id to the list:


1. Enter sp_search_source.list in the Application Navigator filter to access the list of Search
Source records.
2. Open the record of interest.
3. Select Copy sys_id on the record’s Context menu.
4. Open the glide.service_portal.default_search_sources System Property.
5. Add a comma to the end of the string in the Value field.
6. Paste the sys_id immediately after the comma you added in the previous step.

To change the order in which Search Sources display in Search lists, change the order of the ID's
in the property.

IMPORTANT
Default Search Sources do NOT work in partnership with a Portal’s defined Search
Sources. Once a Portal record defines a Search Source, the default Search Sources are
no longer used. This means if you only define the Knowledge Base Search Source, only
Knowledge Base results are returned. You must define all Search Sources (e.g. Service
Catalog, Case, etc.) that are also required by a Portal.

Service Portal Fundamentals 21


© 2022 ServiceNow, Inc. All Rights Reserved
1. Create and name a new Search Source.
2. On the Data Source tab, select the Is scripted source checkbox.
3. In the Data fetch script field:
• Define the search function to be executed by the instance.
• Decode the JSON object being returned, iterate over each result, and set
expected fields.
4. Update the code in the Search page template to open the search results in the
external site.

Tutorials for setting up external Search Sources to a GitHub repository and a


Knowledge Base in another instance are available within Product Documentation.

Service Portal Fundamentals 22


© 2022 ServiceNow, Inc. All Rights Reserved
Service Portal Fundamentals 23
© 2022 ServiceNow, Inc. All Rights Reserved
A Text Index is made up of unique terms gathered from the text being indexed. For
example, if the indexed text contains the phrase “Service Portal,” the Text Index
contains two unique values: “Service” and “Portal”. Because the list of unique
values can be easily searched, search queries can quickly locate matching
records.

Service Portal Fundamentals 24


© 2022 ServiceNow, Inc. All Rights Reserved
Follow these steps to generate a Text Index for a table:
1. Navigate to System Definition > Dictionary.
2. Open the record of interest. A table in the System Dictionary is a record with a
Type of Collection and NO Column name.
3. Select the Text index field (true/checked).
4. Save the record, remain on the form.
5. Select the Generate Text Index Related Link.
6. Enter your preferred method of notification when the process is complete.
7. Select OK to close the dialog box.

Once the process is complete, you can confirm it was successful by reviewing
search results in a Typeahead Widget or by confirming the Search for text option
appears in the drop-down at the top of the table’s list view.

The system maintains text indexes on a daily schedule.

Visit Product Docs if you are interested in learning more about Text Indexing.

Service Portal Fundamentals 25


© 2022 ServiceNow, Inc. All Rights Reserved
To include a table within a Text Index Group, you will need to update tables from V3
to the new V4 indexing format. V4 indexing provides the normalization across
tables.

To create an index group that specifies all of the tables to index together (in a V4
format) so they can be searched together, do the following:
• Navigate to System Definition -> Text Index Groups
• Select New and configure the record:
• Label: enter a name for the group of tables to be indexed and
searched together.
• Tables: click the unlock icon and use the magnifying glass to add
tables to the index group. Tables formatted with V3 and V4 can be
added to index groups. If you add V3 tables, the index group will be
inactive.
• Active: If this field is unselected, make the index group active by
clicking Activate Index Group under Related links. Activating the
index group re-indexes all non-V4-formatted tables to V4.
• Click Submit.

To learn more about Text Index Groups, refer to Configure multiple tables for
indexing and searching in the Product Documentation.

Note: Text Index Groups do not support external search sources.

Service Portal Fundamentals 26


© 2022 ServiceNow, Inc. All Rights Reserved
By default, the Search Event [sys_search_event] and Search Source Event [sys_search_source_event]
tables collect search data from base system search widgets. To generate search analytics from
custom Service Portal search widgets, use the GlideSPSearchAnalytics API.

The Search Event table contains overall metrics about the search query and the Search Source Event
table is a child table that captures which Search Sources the results from the Search Event were
found in.

Search Event Fields:


• Search query – the query text entered by the user
• User – reference to the user who submitted the query
• Application ID – Document ID containing the name of the Portal where the query was submitted
• UI Source – name of the Portal Page where the query was submitted
• Has results – whether or not results were found (T/F)
• Number of results – A value of 0 means that a user searched but did not get any search results
• Click rank – integer that shows which suggestion in the list of suggestions a user selected
• Refinements – the number of actions (i.e. filtering or sorting) a user took to reduce the number of
search results
• Language – the language associated to the user who submitted the query
• Session – the session ID for the user

Search Source Event Fields:


• Search query – the query text entered by the user
• Has results – whether or not results were found (T/F)
• Search Event – reference to parent Search Event record
• Source – sys ID of the Search Source record returning the result
Service Portal Fundamentals 27
© 2022 ServiceNow, Inc. All Rights Reserved
The ServiceNow Performance Analytics Content Pack for Service Portal is available
on the ServiceNow store (https://store.servicenow.com) without additional cost for
customers who already have a Performance Analytics subscription.

Service Portal Fundamentals 28


© 2022 ServiceNow, Inc. All Rights Reserved
Service Portal Fundamentals 29
© 2022 ServiceNow, Inc. All Rights Reserved
Service Portal Fundamentals 30
© 2022 ServiceNow, Inc. All Rights Reserved
Create a Search Source

SPF Lab 15 minutes

Lab objectives
In this lab, you will create a Search Source, using the legacy Zing Search functionality,
in the SPF Demo (/spfdemo) Service Portal.

A. Review the Current Search Results


1. Navigate to the live view of the SPF Demo homepage (/spfdemo).

2. Type "vpn" in the Keyword Search field and press <Enter> on your keyboard.

3. Review the results. How many items are in the list?


___________________________

4. Search Sources have not been identified for this Portal yet, how did the
Widget Instance determine these search results?
_____________________________________________________________________

_____________________________________________________________________

B. Create an Incident Search Source


1. Select Service Portal > Portals on the Application Navigator.

2. Open the SPF Demo record.

3. Update the value of the Theme field to La Jolla.

4. Save the record and remain on the form.

5. Select New on the Search Sources Related List.

Service Portal Fundamentals 31


© 2022 ServiceNow, Inc. All Rights Reserved
6. Configure the record.
Name: Major Incidents in Progress
ID: majorincs

On the Data Source tab:


Table: Incident [incident]
Conditions: Active | is | true AND
Priority | is one of | 1-Critical and 2-High
Primary display field: Short description
Paginate results: true

7. Select Save on the record’s Context menu to stay on the form.

Service Portal Fundamentals 32


© 2022 ServiceNow, Inc. All Rights Reserved
8. Create a Search Facet for the Major Incidents in Progress Search Source.

• Select New in the Facets Related List.


• Configure the record.
Name: Priority
Selection type: Multiple
Order: 100
Field: Priority
• Submit.

9. Create another Search Facet for the Major Incidents in Progress Search
Source.

• Select New in the Facets Related List


• Configure the record.
Name: Opened
Selection type: Single
Use mapped facet filters: true
Order: 200

• Select Save on the record’s Context menu to stay on the form.

Service Portal Fundamentals 33


© 2022 ServiceNow, Inc. All Rights Reserved
10. Create 2 Facet Filters for the Opened Facet.
• Select New in the Facet Filters Related List.
• Configure the record.
Name: Opened Within Last 30 Days
Order: 100
Mapped query: Opened | on | Last 30 days

• Submit.

11. Create another Facet Filter by selecting New in the Facet Filters Related List.

• Configure the record.


Name: Opened Longer Than 30 Days
Order: 200
Mapped query: Opened | before | Last 30 days

• Submit.

12. Refresh the live view of the SPF Demo (/spfdemo).

13. Type "vpn" in the Keyword Search field and press <Enter> on your keyboard.

14. Review the results. How many items are in the list?
___________________________

Service Portal Fundamentals 34


© 2022 ServiceNow, Inc. All Rights Reserved
15. What happened to the search results from the Knowledge Base and
Catalogs Search Sources?

_____________________________________________________________________

_____________________________________________________________________

C. Add All of the Required Search Sources to the Portal


1. In the platform view, navigate to Service Portal > Portals on the Application
Navigator and open the SPF Demo Portal record if it not already open.

2. Select Edit on the Search Sources Related List.

3. Within the list collector interface, move the Knowledge Bases and Catalogs
records from Collection on the left to Search Sources List on the right.

4. Save.

Service Portal Fundamentals 35


© 2022 ServiceNow, Inc. All Rights Reserved
5. Drill into each record to update its Order field as shown in the image below.
These Search Sources should appear in this order in the SPF Demo Portal.

D. Configure Pagination
1. Refresh the live view of the SPF Demo homepage (/spfdemo).

2. Type "vpn" in the Keyword Search field and press <Enter> on your keyboard.

Select CTRL+right-click on the Facet Search and select Instance Options.

Service Portal Fundamentals 36


© 2022 ServiceNow, Inc. All Rights Reserved
3. Set Max results for a single search source to be 3.

4. Save.

E. Test Your Work


1. Refresh the live view of the SPF Demo homepage (/spfdemo).

2. Type "vpn" in the Keyword Search field and press <Enter> on your keyboard.

3. Do the Search Sources in the Faceted Search Widget Instance display in the
correct order? If not, debug and re-test.

Service Portal Fundamentals 37


© 2022 ServiceNow, Inc. All Rights Reserved
4. Do the Search Facets for the Major Incidents in Progress search source show
up on the left? If not, debug and re-test.

5. Type “access” in the search box at the top of the page and press <Enter> on
your keyboard.

Select the Major Incidents in Progress link in the Sources box to narrow down
the search results. Verify only 3 results are initially displayed and you see a
Load more results link at the bottom of the list. If not, debug and re-test.

Example on next page.

Service Portal Fundamentals 38


© 2022 ServiceNow, Inc. All Rights Reserved
6. Verify that both the Priority and Opened Facet filters work as expected by
applying each one at a time.
• There are seven 1 - Critical incidents
• There is one 2 - High incident
• There are 0 incidents Opened Within Last 30 Days
• There are three incidents Opened Longer Than 30 days
Note: The actual results of the Opened Within Last 30 Days and
Opened Longer Than 30 Days filters can vary from the results stated
above, depending on the dates of the incidents in the student
instance.

7. Click on the Knowledge Bases link in the Sources box to narrow down the
search results. Notice there is no Load more results link at the bottom of the
list – why?

Hint: Check the Paginate results field on the Knowledge Bases Search
Source record.

Congratulations! You have completed this lab.

Service Portal Fundamentals 39


© 2022 ServiceNow, Inc. All Rights Reserved
Service Portal Fundamentals 40
© 2022 ServiceNow, Inc. All Rights Reserved
Service Portal Fundamentals 41
© 2022 ServiceNow, Inc. All Rights Reserved

You might also like