SharePoint Tips

Tuesday, January 16, 2018

SharePoint Search Query CollapseSpecification

Collapse similar search results using the CollapseSpecification property


The CollapseSpecification property takes a Spec parameter that can contain multiple fields separated either by a comma or a space, which evaluated together specify a set of criteria used for collapsing.

Syntax: CollapseSpecification = Spec

Table 1. Spec parameter fields
Element in parameterDescription
Spec Subspec(<space>Subspec)* 
Subspec Prop(','Prop)*[':'Dups] 
Prop A valid managed property or an alias of a managed property. Prop is case-insensitive. The managed property must be queryable and either sortable or refineable. 
Dups An integer specifying the number of items to retain. The default value is 1. 

Properties are combined by using the OR operator. 
, Properties are combined by using the AND operator. 
* Indicates more items. 
() or [] Indicates optional items. 
If the fields in Spec are separated by commas, the fields are combined by using the AND operator. If all of the specified fields are matched, the items are collapsed.
In contrast, if the fields in Spec are separated by spaces, the fields (or Subspecs) are combined by using an expansion that includes both the AND operator and ORoperator. For example, an expression such as Category:3 Product:2 is internally transformed to the following expression (Category AND Product) OR (Category) with a counter for each; hence a maximum of two of the former and three of the latter. Items are collapsed if some of the specified fields are matched.
Ref: https://docs.microsoft.com/en-us/sharepoint/dev/general-development/customizing-search-results-in-sharepoint

Tuesday, January 9, 2018

Tools for writing and debugging RegEx



·         RegExr (for JavaScript)
·         Perl: YAPE: Regex Explain
·         Regex Coach (engine backed by CL-PPCRE)
·         RegexPal (for JavaScript)
·         Regex Buddy
·         Regex 101 (for PCRE, JavaScript, Python, Golang)
·         Visual RegExp
·         Expresso (for .NET)
·         Rubular (for Ruby)
·         Regular Expression Library (Predefined Regexes for common scenarios)
·         Txt2RE
·         Regex Tester (for JavaScript)
·         Regex Storm (for .NET)


Books


·         Mastering Regular Expressions, the 2nd Edition, and the 3rd edition.
·         Regex Cookbook

Free resources

·         Regular Expressions - Everything you should know (PDF Series)
·         Regex Syntax Summary
·         How Regexes Work