Shipping manual segments via plugins
Summarize
Summary of Shipping manual segments via plugins
Business unit application developers can include manual segments with their applications to provide domain-specific saved searches immediately upon installation. Manual segments are prioritized over automated segments during search and maintain all their filters unless irrelevant. Shipping manual segments via plugins enables users to ask natural language questions about application data using familiar business terms without waiting for automated segment generation.
Show less
How to Ship Manual Segments
- Create manual segment configuration records (snquerygensegmenttableconfig) in a development instance.
- Verify correct synchronization and expected search results in testing environments.
- Include these configuration records in the application update set for plugin delivery.
Plugin Installation Behavior: Business rules are bypassed during installation, so manual segments sync only after the next scheduled semantic layer generation or weekly sync job runs. Manual segments are not immediately available post-installation. Avoid duplicating segment records as no database-level uniqueness constraint exists.
Example
For instance, an ITSM application can ship manual segments for the incident table, such as “Critical Open Incidents” (high priority, open incidents), “My Team's Overdue Incidents” (incidents assigned to the user’s group past SLA due date), and “Recent P1/P2 Escalations” (priority 1 or 2 incidents escalated in the last 7 days). The incident table must have an active entity in the semantic layer with semantic generation enabled.
Best Practices
- Focus on high-value, frequently queried tables to maximize impact.
- Use user-friendly, business language for segment names rather than technical codes.
- Provide clear descriptions to help the system select the correct segment when multiple exist for one table.
- Test segments thoroughly in non-production environments to ensure proper syncing and accurate search results.
- Avoid duplicating segments already covered by automated segments; improve existing ones if needed.
Pre-Shipping Checklist
- Confirm target tables have active entities with semantic generation enabled.
- Ensure segment names use plain language and descriptions clarify ambiguous names.
- Validate filters as encoded queries under 2,000 characters for optimal LLM processing.
- Check for duplicate segment names per table and remove any duplicates.
- Include all manual segment configuration records in the update set.
- Verify in test environments that segments sync properly and appear in search results.
Post-Deployment Monitoring
- Monitor query logs to track which manual segments are matched.
- Validate that generated queries fulfill intended use cases.
- Gather user feedback on query accuracy and coverage.
- Refine segment names and descriptions based on usage patterns to improve matching and results.
- Address inaccurate results primarily by adjusting segment names and descriptions before changing system properties.
Business unit application developers can ship manual segments with their applications to provide domain-specific saved searches that work from the moment the app is installed.
Shipping overview
Manual segments are the recommended way to ship domain-specific saved searches with your application. They receive a priority boost over automated segments during search, and the LLM is instructed to retain all their filters unless completely irrelevant—whereas automated segment filters are critiqued individually.
Shipping manual segments with your plugin ensures that users can immediately ask natural language questions about your application's data using business terminology, without waiting for automated segments to be generated from usage patterns.
How to ship manual segments
- Create your manual segment config records in a development instance.
- Verify they sync correctly and produce expected search results.
- Include the sn_query_gen_segment_table_config records in your app's update set.
Plugin installation behavior
Understanding how manual segments behave during plugin installation is important for setting proper expectations:
- Business rules are bypassed during plugin installation—the async sync will not fire automatically at install time.
- The records will be synced into sn_query_gen_segment the next time the Generate Semantic Layer scheduled job runs (post-install) or when the weekly Sync Segments job runs.
- Ensure your plugin does not ship duplicate records. There is no unique constraint at the database level—admins must ensure no duplicate names per entity.
Example: Full configuration for a table
The following example shows manual segments for the incident table that could be shipped with an ITSM application:
Prerequisite: The incident table must have a record in sn_query_gen_table_config with enable_semantic_generation = true and an active entity.
| Name | Description | Table | Filter |
|---|---|---|---|
| Critical Open Incidents | High priority incidents that are currently open and unresolved. Includes all assignment groups. | incident | priority=1^state!=7^state!=8 |
| My Team's Overdue Incidents | Incidents assigned to the current user's group that have passed their SLA due date. | incident | assignment_group=javascript:getMyGroups()^sla_due<javascript:gs.nowDateTime()^state!=7 |
| Recent P1/P2 Escalations | Priority 1 and 2 incidents escalated in the last 7 days. | incident | priority<=2^escalation=1^sys_updated_on>=javascript:gs.daysAgoStart(7) |
Best practices for shipping segments
- Focus on high-value, high-traffic tables
- Concentrate manual segments on the tables your users ask about most. A handful of well-crafted segments on your app's primary tables will have more impact than broad coverage across rarely-queried tables.
- Use business language, not technical codes
- Segment names should match how users naturally speak about your domain. "Critical Open Incidents" is better than "P1_OPEN_INC".
- Provide descriptions for disambiguation
- If you ship multiple segments for the same table, descriptions help the LLM pick the right one. Without descriptions, the LLM may arbitrarily choose between similar matches.
- Test before shipping
- Verify in a test environment that segments sync correctly and appear in search results for relevant utterances. Check the query logs to confirm matching behavior.
- Avoid duplicating automated segments
- Before creating a manual segment, check whether an automated segment already covers the same filter. If one exists but has a poor name, consider improving the source rather than creating a duplicate.
Checklist before shipping
Verify the following before including manual segments in your plugin:
- Each target table has an active entity in the semantic layer (sn_query_gen_table_config with enable_semantic_generation = true)
- Segment names are written in plain user language, not technical shorthand
- Descriptions are provided for segments where the name alone may be ambiguous
- Filters are valid encoded queries and under 2,000 characters for optimal LLM prompt inclusion
- No duplicate records (same name + table combination) exist in your update set
- All sn_query_gen_segment_table_config records are included in your app's update set
- You have verified in a test environment that segments sync correctly and appear in search results for relevant utterances
Monitoring after deployment
After shipping manual segments with your application:
- Monitor which segments are being matched in the query logs
- Verify that generated queries are correct for the intended use cases
- Collect user feedback on query accuracy and coverage
- Iterate on segment names and descriptions based on usage patterns
If a segment is matching but producing wrong results, the issue is usually the name being too generic or the filter being too broad. Refine the name and description before adjusting system properties.