sharepointsharepoint-search

Refinement values stopped to return "hints"


I have a problem with refinement values returned by the search in the SharePoint 2016. I do not know when this started to appear but maybe it is connected with the migration from SP 2013 to SP 2016? Later we have returned from the search refinements and the values looked like this:

Refinement Value: Organizational:ColAfterSyncUpg  GP0|#1dc79002-d32b-4faa-89f3-08ab45051e70  L0|#01dc79002-d32b-4faa-89f3-08ab45051e70|Organizational:ColAfterSyncUpg  GTSet|#4642cdf4-872b-4179-96f5-043fbadb0fcf  GPP|#4f668d16-2643-436b-b72b-0f180ccae0e6

This value was taken from managed property which has attached two crawled properties:

ows_<managed_metadata_field_name>
ows_taxId_<managed_metadata_field_name>

. Thanks to that I could get correct GUID and in the search query pass some refinement filters. But now (I do not know when this started to happen), when I add a new document to an empty collection (without old, correct files) the search is crawling this field and returns only:

Refinement Value: Organizational:ColAfterSyncUpg

I suppose that the second crawled property (ows_taxid) is empty. But why? Did something changed in the SP 2016 and now this property is not created or what? "Old" files are crawled ok, "new" not ok...

EDIT: Found out that when I edit the item manually, then everything is ok and the search returns correct values with GUIDS. So maybe there is something wrong with the code? The code is quite complicated but some parts of it:

var taxValue =
            new TaxonomyFieldValue(field)
            {
                TermGuid = tagDto.TagId.ToString(),
                Label = tagDto.DefaultLabel,
                WssId = -1
            };
field.SetFieldValue(entity, taxValue);
entity.UpdateOverwriteVersion();

Solution

  • I have found out what was causing the problem. One of my team members disabled events during document provisioning by our code. Looks like SP has some events which generate those values and events cannot be disabled if you need them.