Share via


Context.AddAndExpression Method

Adds an AND aggregate context expression on the context.

Namespace:  Microsoft.SharePoint.Search.Extended.Administration.Keywords
Assembly:  Microsoft.SharePoint.Search.Extended.Administration (in Microsoft.SharePoint.Search.Extended.Administration.dll)

Syntax

'Declaration
Function AddAndExpression As AggregateContextExpression
'Usage
Dim instance As Context
Dim returnValue As AggregateContextExpression

returnValue = instance.AddAndExpression()
AggregateContextExpression AddAndExpression()

Return Value

Type: Microsoft.SharePoint.Search.Extended.Administration.Keywords.AggregateContextExpression
A AggregateContextExpression represented the added AND-expression.

Remarks

This method should be used to get a handle to the context expression. Subsequent expression nodes should be added to the handle returned by this call and not on the context. This method will overwrite any previous context expressions on the context

Examples

This example shows how to add a simple and-expression

             // The expression to be added is AND(employeeType="FTE";location="Redmond")
            
                SearchSettingGroup group = ....... // use existing or create new 
                Keyword keyword = group.Keywords.AddKeyword("Headquarter");
            
                var employeeContext = group.Contexts.AddContext("employee");
                var employeeExpression = employeeContext.AddAndExpression();
                employeeExpression.AddMatchExpression("employeeType", "FTE");
                employeeExpression.AddMatchExpression("location", "Redmond");
                keyword.AddSynonym("HQ",employeeContext); 
            

See Also

Reference

Context Interface

Context Members

Microsoft.SharePoint.Search.Extended.Administration.Keywords Namespace