question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

SPSearchManagedProperty: Can't define Searchable

See original GitHub issue

Details of the scenario you tried and the problem that is occurring

I tried to add a search managed property. I wanted it to be searchable. This is the configuration I tried:

SPSearchManagedProperty TargetAudience
{
	ServiceAppName				= "Search Service Application"
	Name						= "TargetAudience"
	PropertyType				= "Text"
	Searchable					= $true
	Queryable					= $true
	Retrievable					= $true
	HasMultipleValues			= $true
	Refinable					= $true
	Sortable					= $true
	NoWordBreaker				= $false
	IncludeAllCrawledProperties	= $false
	Ensure						= "Present"
	PsDscRunAsCredential		= $SetupAccount
}

Running this goes smoothly, but trying Test-DscConfiguration will give an error (see below).

Without Searchable = $true there is no error in Test-DcsConfiguration, but still reports as “not in desired state”. If I check Central Administration, the property has been created, but is not searchable.

Information from the node itself:

$status = Get-DscConfigurationStatus
$status.ResourcesNotInDesiredState

ConfigurationName    : SharePoint
ModuleName           : SharePointDSC
ModuleVersion        : 4.3.0
PsDscRunAsCredential :
ResourceId           : [SPSearchManagedProperty]TargetAudience
SourceInfo           : C:\xxxxxxxxxxxxxxx
DurationInSeconds    : 0,469
Error                :
FinalState           :
InDesiredState       : False
InitialState         :
InstanceName         : TargetAudience
RebootRequested      : False
ResourceName         : SPSearchManagedProperty
StartDate            : 10.2.2021 11.46.28
StateChanged         : False
PSComputerName       :

Verbose logs showing the problem

When running Test-DscConfiguration with Searchable = $true:

Exception calling "Add" with "2" argument(s): "Item has already been added. Key in dictionary: 'Searchable'  Key being added: 'Searchable'"
    + CategoryInfo          : NotSpecified: (:) [], CimException
    + FullyQualifiedErrorId : ArgumentException
    + PSComputerName        : xxxxxxxx

The PowerShell DSC resource '[SPSearchManagedProperty]TargetAudience' with SourceInfo 'C:\xxxxxxxx' threw one or more non-terminating errors while running the Test-TargetResource functionality. These errors are
 logged to the ETW channel called Microsoft-Windows-DSC/Operational. Refer to this channel for more details.
    + CategoryInfo          : InvalidOperation: (root/Microsoft/...gurationManager:String) [], CimException
    + FullyQualifiedErrorId : NonTerminatingErrorFromProvider
    + PSComputerName        : xxxxxxxxxxxxxxx

Suggested solution to the issue

N/A

The DSC configuration that is used to reproduce the issue (as detailed as possible)

See beginning.

The operating system the target node is running

N/A

Version and build of PowerShell the target node is running

PSVersion 5.1.14393.3866 BuildVersion 10.0.14393.3866

Version of the DSC module that was used

SharePointDSC 4.3.0

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
ykuijscommented, Mar 17, 2021

Hi @rurikon, I found the cause of this issue. Apparently it helps if you only check a property once 😜: https://github.com/dsccommunity/SharePointDsc/blob/90f23bc730cd8d651cc4d195429d7ee659598f13/SharePointDsc/DSCResources/MSFT_SPSearchManagedProperty/MSFT_SPSearchManagedProperty.psm1#L472-L474

Will fix this issue in my next Bugfix PR, which will be included in v4.6.

1reaction
rurikoncommented, Feb 23, 2021

Oh sorry, stupid me 😃 It doesn’t give much more info, but here it is:

VERBOSE: [XXXXX]: LCM:  [ Start  Resource ]  [[SPSearchManagedProperty]TargetAudienceTest]
VERBOSE: [XXXXX]: LCM:  [ Start  Test     ]  [[SPSearchManagedProperty]TargetAudienceTest]
VERBOSE: [XXXXX]:                            [[SPSearchManagedProperty]TargetAudienceTest] Testing Managed Property Setting for 'TargetAudienceTest'
VERBOSE: [XXXXX]:                            [[SPSearchManagedProperty]TargetAudienceTest] Getting Managed Property Setting for 'TargetAudienceTest'
VERBOSE: [XXXXX]:                            [[SPSearchManagedProperty]TargetAudienceTest] Executing as the local run as user XXXXX
VERBOSE: [XXXXX]:                            [[SPSearchManagedProperty]TargetAudienceTest] Leaving BeginProcessing Method of Get-SPEnterpriseSearchServiceApplication.
VERBOSE: [XXXXX]:                            [[SPSearchManagedProperty]TargetAudienceTest] Leaving ProcessRecord Method of Get-SPEnterpriseSearchServiceApplication.
VERBOSE: [XXXXX]:                            [[SPSearchManagedProperty]TargetAudienceTest] Leaving EndProcessing Method of Get-SPEnterpriseSearchServiceApplication.
VERBOSE: [XXXXX]:                            [[SPSearchManagedProperty]TargetAudienceTest] Leaving BeginProcessing Method of Get-SPEnterpriseSearchMetadataManagedProperty.
VERBOSE: [XXXXX]:                            [[SPSearchManagedProperty]TargetAudienceTest] Leaving ProcessRecord Method of Get-SPEnterpriseSearchMetadataManagedProperty.
VERBOSE: [XXXXX]:                            [[SPSearchManagedProperty]TargetAudienceTest] Leaving EndProcessing Method of Get-SPEnterpriseSearchMetadataManagedProperty.
VERBOSE: [XXXXX]:                            [[SPSearchManagedProperty]TargetAudienceTest] Current Values: Ensure=Absent; Name=TargetAudienceTest; PropertyType=Text; ServiceAppName=Search Service Application
VERBOSE: [XXXXX]:                            [[SPSearchManagedProperty]TargetAudienceTest] Target Values: Ensure=Present; HasMultipleValues=True; IncludeAllCrawledProperties=False; Name=TargetAudienceTest; NoWordBreaker=False; PropertyType=Text; Queryable=True; Refinable=True; Retrievable=True; Searchable=True; ServiceAppName=Search Service Application; Sortable=True; TokenNormalization=True; Verbose=True
Exception calling "Add" with "2" argument(s): "Item has already been added. Key in dictionary: 'Searchable'  Key being added: 'Searchable'"
    + CategoryInfo          : NotSpecified: (:) [], CimException
    + FullyQualifiedErrorId : ArgumentException
    + PSComputerName        : XXXXX

VERBOSE: [XXXXX]:                            [[SPSearchManagedProperty]TargetAudienceTest] Test-TargetResource returned False
VERBOSE: [XXXXX]: LCM:  [ End    Test     ]  [[SPSearchManagedProperty]TargetAudienceTest] False in 0.6090 seconds.
VERBOSE: [XXXXX]: LCM:  [ *FAILED*Compare  ]     Completed processing compare operation. The operation returned False.
The PowerShell DSC resource '[SPSearchManagedProperty]TargetAudienceTest' with SourceInfo 'C:\XXXXX::SPSearchManagedProperty' threw one or more non-terminating errors while running the Test-TargetResource functionality. These errors are logged to the ETW channel called Microsoft-Windows-DSC/Operational. Refer to this channel for more details.
    + CategoryInfo          : InvalidOperation: (root/Microsoft/...gurationManager:String) [], CimException
    + FullyQualifiedErrorId : NonTerminatingErrorFromProvider
    + PSComputerName        : XXXXX

VERBOSE: Operation 'Invoke CimMethod' complete.

We had to work on the actual property to get our project forward, so I went to Central Administration and manually checked the “Searchable” checkbox for the TargetAudience I created before. It might be relevant that after I manually checked it, the error disappeared for that property, even though it still has Searchable = $true. Here are the verbose logs for that one:

VERBOSE: [XXXXX]: LCM:  [ Start  Resource ]  [[SPSearchManagedProperty]TargetAudience]
VERBOSE: [XXXXX]: LCM:  [ Start  Test     ]  [[SPSearchManagedProperty]TargetAudience]
VERBOSE: [XXXXX]:                            [[SPSearchManagedProperty]TargetAudience] Testing Managed Property Setting for 'TargetAudience'
VERBOSE: [XXXXX]:                            [[SPSearchManagedProperty]TargetAudience] Getting Managed Property Setting for 'TargetAudience'
VERBOSE: [XXXXX]:                            [[SPSearchManagedProperty]TargetAudience] Executing as the local run as user XXXXX
VERBOSE: [XXXXX]:                            [[SPSearchManagedProperty]TargetAudience] Leaving BeginProcessing Method of Get-SPEnterpriseSearchServiceApplication.
VERBOSE: [XXXXX]:                            [[SPSearchManagedProperty]TargetAudience] Leaving ProcessRecord Method of Get-SPEnterpriseSearchServiceApplication.
VERBOSE: [XXXXX]:                            [[SPSearchManagedProperty]TargetAudience] Leaving EndProcessing Method of Get-SPEnterpriseSearchServiceApplication.
VERBOSE: [XXXXX]:                            [[SPSearchManagedProperty]TargetAudience] Leaving BeginProcessing Method of Get-SPEnterpriseSearchMetadataManagedProperty.
VERBOSE: [XXXXX]:                            [[SPSearchManagedProperty]TargetAudience] Leaving ProcessRecord Method of Get-SPEnterpriseSearchMetadataManagedProperty.
VERBOSE: [XXXXX]:                            [[SPSearchManagedProperty]TargetAudience] Leaving EndProcessing Method of Get-SPEnterpriseSearchMetadataManagedProperty.
VERBOSE: [XXXXX]:                            [[SPSearchManagedProperty]TargetAudience] Current Values: Aliases=(); Ensure=Present; HasMultipleValues=True; IncludeAllCrawledProperties=True; Name=TargetAudience; NoWordBreaker=False; PropertyType=Text; Queryable=True; Refinable=True; Retrievable=True; SafeForAnonymous=False; Searchable=False; ServiceAppName=Search Service Application; Sortable=True; TokenNormalization=True
VERBOSE: [XXXXX]:                            [[SPSearchManagedProperty]TargetAudience] Target Values: Ensure=Present; HasMultipleValues=True; IncludeAllCrawledProperties=False; Name=TargetAudience; NoWordBreaker=False; PropertyType=Text; Queryable=True; Refinable=True; Retrievable=True; ServiceAppName=Search Service Application; Sortable=True; TokenNormalization=True; Verbose=True
VERBOSE: [XXXXX]:                            [[SPSearchManagedProperty]TargetAudience] Test-TargetResource returned False
VERBOSE: [XXXXX]: LCM:  [ End    Test     ]  [[SPSearchManagedProperty]TargetAudience] False in 2.3280 seconds.
VERBOSE: [XXXXX]: LCM:  [ End    Resource ]  [[SPSearchManagedProperty]TargetAudience]
Read more comments on GitHub >

github_iconTop Results From Across the Web

Overview of the search schema in SharePoint Server
The search schema contains crawled properties, crawled property categories, the crawled to managed property mapping and the managed property ...
Read more >
Searchable vs. Queryable vs. Retrievable vs. Refinable
In this article, I explain 4 main characteristics of SharePoint Managed Properties: Searchable, Queryable, Retrievable, Refinable.
Read more >
SharePoint Search managed property: Difference 'query' ...
Searchable: Enables querying against the content of the managed property. The content of this managed property is included in the full-text ...
Read more >
SharePoint search managed properties
Search schema contains a list of useful content and metadata called managed properties. The search only index from the managed property.
Read more >
What makes a SharePoint column searchable?
Manage properties: Managed properties define search behavior. To configure a managed property for a SharePoint column, navigate to the search schema and ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found