0

Trying use Find-Item to get all items where _Source has a value set. Normally the _Source is null, so I thought that this would be sufficient - check for $null with -Invert set:

$FilterCriteria = @(
    @{Filter = "Equals"; Field = "_Source"; Value = $null; Invert=$true },
    @{Filter = "StartsWith"; Field = "_fullpath"; Value = "/sitecore/content/Website/sitex" }
)

$itemsToProcess = Find-Item -Index "sitecore_master_index" -Criteria $FilterCriteria -First 10 | Initialize-Item

It isn't working... Then I thought that I could use "contains" as filter for _Source-field, as the field starts with a "sitecore..."-string if set:

$FilterCriteria = @(
    @{Filter = "Contains"; Field = "_Source"; Value = "sitecore" },
    @{Filter = "StartsWith"; Field = "_fullpath"; Value = "/sitecore/content/Website/sitex" }
)

$itemsToProcess = Find-Item -Index "sitecore_master_index" -Criteria $FilterCriteria -First 10 | Initialize-Item

Nothing seems to be working on the "_Source"-field - any clues to make this work?!?

2
  • What field type is _Source? Commented Aug 8, 2023 at 19:16
  • The field type is “Version Link”
    – Kurt Bilde
    Commented Aug 8, 2023 at 19:49

1 Answer 1

1

By default Solr won't store anything for null value so you can try wildcard character "*".

I have tested below example and its working.

You need to make sure that _source field exists in Solr. Also, since all fields in Solr are in lowercase so you need to change the case from _Source to _source.

$FilterCriteria = @(
    @{Filter = "Equals"; Field = "_source"; Value = "*"; },
    @{Filter = "StartsWith"; Field = "_fullpath"; Value = "/sitecore/content/Website/sitex" }
)

$itemsToProcess = Find-Item -Index "sitecore_master_index" -Criteria $FilterCriteria -First 10 | Initialize-Item
2
  • @KurtBilde - did it work for you? Commented Aug 9, 2023 at 14:44
  • Nope but this it must be due to the field missing in the index....
    – Kurt Bilde
    Commented Aug 9, 2023 at 15:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.