IR_AND_OR_QUERY in service portal search source
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-21-2018 11:03 AM
Hey,
We are using Service Portal on Istanbul and we are trying to change the search method in the service catalog search source.
the original script was:
var sc = new GlideRecord('sc_cat_item');
sc.addQuery('123TEXTQUERY321', query);
sc.addQuery('active',true);
sc.addQuery('no_search', '!=', true);
sc.addQuery('visible_standalone', true);
sc.addQuery('sys_class_name', 'NOT IN', 'sc_cat_item_wizard');
var portalValue = $sp.getValue('sc_catalog');
if (portalValue)
sc.addQuery('sc_catalogs', portalValue);
sc.query();
I change the line sc.addQuery('123TEXTQUERY321', query) to:
sc.addQuery('IR_AND_OR_QUERY', query);
but I still don't get the OR part, for instance:
I have 2 items with the following description:
item 1: Ariba Spend Visibility (SV) is a web-based solution for indirect and direct global spend analysis. It helps users to have visibility into spending, make more insightful sourcing decisions, and identify more ways to cut costs.
item 2: Ariba Procure To Pay (P2P) is a platform for managing upstream and downstream procurement processes. It's a cloud based application, shared globally in order to enable savings, increase efficiency, and allow global visibility of indirect spend. Ariba is integrated to a back-end ERP system. It includes sourcing, contract and supplier performance management, and advanced Procure-to-Pay processes.
when I search for Global insight I expect to get both of them (I have global in both) but I got only item 1 (it has global and insightful).
Can any one explain why?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-21-2018 02:54 PM
See if the following can help you. It has a section on "OR" Query.
https://www.servicenowguru.com/scripting/gliderecord-query-cheat-sheet/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-22-2018 05:34 AM
hello i do not think a simple OR condition will meet the requirement.
Michal is trying to perform a text search "IR_AND_OR_QUERY" for records indexed for the words "global" AND/OR "insight".
it seems to be performing only the AND operation and therefore excluding the cat items do not have the word "insight" in the description.
see following about text searching from script:
Search Operator | Description |
---|---|
IR_AND_QUERY | Display results with exact matches of all terms only (Same as 123TEXTQUERY321) |
IR_OR_QUERY | Display results with any matches of any terms. |
IR_AND_OR_QUERY | First display results with exact matches of all terms, then display results with any matches of any terms |
using "IR_OR_QUERY" will give the records as required eg. record indexed for the word "global" or the word "insight".
however that does not explain why "IR_AND_OR_QUERY" is only performing the AND and excluding OR operation when making the text search in Michal's case. Further research would be required.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-20-2019 03:01 AM
Replying over to old thread as it may help others to understand how the IR_AND_OR_QUERY works. And probably that is the reason why michal_v getting 1 result.
The IR_AND_OR_QUERY executes according to its name:
- Execute IR_AND_QUERY
- Check number of results against glide.ts.query.and_or_limit property or text_search_and_or_limit table attribute
- If # of results is greater
- Return results
- If # of results is less than
- Execute IR_OR_QUERY and return results