@antonytm/mcp-sitecore-server 1.0.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -0
- package/dist/bundle.js +106 -12
- package/dist/register.js +7 -0
- package/dist/register.js.map +1 -1
- package/dist/tools/powershell/documentation/add-basetemplate.md +137 -0
- package/dist/tools/powershell/documentation/add-itemacl.md +254 -0
- package/dist/tools/powershell/documentation/add-itemversion.md +231 -0
- package/dist/tools/powershell/documentation/add-placeholdersetting.md +410 -0
- package/dist/tools/powershell/documentation/add-rendering.md +217 -0
- package/dist/tools/powershell/documentation/add-rolemember.md +88 -0
- package/dist/tools/powershell/documentation/clear-itemacl.md +131 -0
- package/dist/tools/powershell/documentation/close-window.md +32 -0
- package/dist/tools/powershell/documentation/commands-list.md +134 -0
- package/dist/tools/powershell/documentation/convertfrom-clixml.md +67 -0
- package/dist/tools/powershell/documentation/convertfrom-itemclone.md +118 -0
- package/dist/tools/powershell/documentation/convertto-clixml.md +66 -0
- package/dist/tools/powershell/documentation/disable-user.md +89 -0
- package/dist/tools/powershell/documentation/enable-user.md +89 -0
- package/dist/tools/powershell/documentation/expand-token.md +144 -0
- package/dist/tools/powershell/documentation/export-item.md +165 -0
- package/dist/tools/powershell/documentation/export-package.md +129 -0
- package/dist/tools/powershell/documentation/export-role.md +150 -0
- package/dist/tools/powershell/documentation/export-updatepackage.md +111 -0
- package/dist/tools/powershell/documentation/export-user.md +147 -0
- package/dist/tools/powershell/documentation/find-item.md +718 -0
- package/dist/tools/powershell/documentation/get-archive.md +73 -0
- package/dist/tools/powershell/documentation/get-archiveitem.md +138 -0
- package/dist/tools/powershell/documentation/get-cache.md +62 -0
- package/dist/tools/powershell/documentation/get-database.md +96 -0
- package/dist/tools/powershell/documentation/get-domain.md +75 -0
- package/dist/tools/powershell/documentation/get-item.md +186 -0
- package/dist/tools/powershell/documentation/get-itemacl.md +168 -0
- package/dist/tools/powershell/documentation/get-itemclone.md +100 -0
- package/dist/tools/powershell/documentation/get-itemclonenotification.md +95 -0
- package/dist/tools/powershell/documentation/get-itemfield.md +182 -0
- package/dist/tools/powershell/documentation/get-itemreference.md +152 -0
- package/dist/tools/powershell/documentation/get-itemreferrer.md +154 -0
- package/dist/tools/powershell/documentation/get-itemtemplate.md +152 -0
- package/dist/tools/powershell/documentation/get-itemworkflowevent.md +133 -0
- package/dist/tools/powershell/documentation/get-layout.md +142 -0
- package/dist/tools/powershell/documentation/get-layoutdevice.md +97 -0
- package/dist/tools/powershell/documentation/get-package.md +63 -0
- package/dist/tools/powershell/documentation/get-placeholdersetting.md +477 -0
- package/dist/tools/powershell/documentation/get-preset.md +70 -0
- package/dist/tools/powershell/documentation/get-rendering.md +248 -0
- package/dist/tools/powershell/documentation/get-renderingparameter.md +84 -0
- package/dist/tools/powershell/documentation/get-role.md +134 -0
- package/dist/tools/powershell/documentation/get-rolemember.md +131 -0
- package/dist/tools/powershell/documentation/get-scriptsession.md +128 -0
- package/dist/tools/powershell/documentation/get-searchindex.md +92 -0
- package/dist/tools/powershell/documentation/get-session.md +107 -0
- package/dist/tools/powershell/documentation/get-sitecorejob.md +102 -0
- package/dist/tools/powershell/documentation/get-spemodule.md +134 -0
- package/dist/tools/powershell/documentation/get-spemodulefeatureroot.md +113 -0
- package/dist/tools/powershell/documentation/get-taskschedule.md +136 -0
- package/dist/tools/powershell/documentation/get-updatepackagediff.md +110 -0
- package/dist/tools/powershell/documentation/get-user.md +193 -0
- package/dist/tools/powershell/documentation/get-useragent.md +38 -0
- package/dist/tools/powershell/documentation/import-function.md +83 -0
- package/dist/tools/powershell/documentation/import-item-1.md +180 -0
- package/dist/tools/powershell/documentation/import-item.md +180 -0
- package/dist/tools/powershell/documentation/import-role.md +137 -0
- package/dist/tools/powershell/documentation/import-user.md +137 -0
- package/dist/tools/powershell/documentation/initialize-item.md +87 -0
- package/dist/tools/powershell/documentation/initialize-searchindex.md +116 -0
- package/dist/tools/powershell/documentation/initialize-searchindexitem.md +85 -0
- package/dist/tools/powershell/documentation/install-package.md +95 -0
- package/dist/tools/powershell/documentation/install-updatepackage.md +90 -0
- package/dist/tools/powershell/documentation/invoke-javascript.md +22 -0
- package/dist/tools/powershell/documentation/invoke-script.md +111 -0
- package/dist/tools/powershell/documentation/invoke-shellcommand.md +144 -0
- package/dist/tools/powershell/documentation/invoke-workflow.md +142 -0
- package/dist/tools/powershell/documentation/lock-item.md +157 -0
- package/dist/tools/powershell/documentation/login-user.md +56 -0
- package/dist/tools/powershell/documentation/logout-user.md +30 -0
- package/dist/tools/powershell/documentation/merge-layout.md +102 -0
- package/dist/tools/powershell/documentation/new-domain.md +72 -0
- package/dist/tools/powershell/documentation/new-explicitfilesource.md +104 -0
- package/dist/tools/powershell/documentation/new-explicititemsource.md +146 -0
- package/dist/tools/powershell/documentation/new-filesource.md +128 -0
- package/dist/tools/powershell/documentation/new-itemacl.md +175 -0
- package/dist/tools/powershell/documentation/new-itemclone.md +139 -0
- package/dist/tools/powershell/documentation/new-itemsource.md +171 -0
- package/dist/tools/powershell/documentation/new-itemworkflowevent.md +140 -0
- package/dist/tools/powershell/documentation/new-package.md +81 -0
- package/dist/tools/powershell/documentation/new-placeholdersetting.md +255 -0
- package/dist/tools/powershell/documentation/new-rendering.md +243 -0
- package/dist/tools/powershell/documentation/new-role.md +56 -0
- package/dist/tools/powershell/documentation/new-securitysource.md +176 -0
- package/dist/tools/powershell/documentation/new-user.md +161 -0
- package/dist/tools/powershell/documentation/new-usingblock.md +95 -0
- package/dist/tools/powershell/documentation/out-download.md +123 -0
- package/dist/tools/powershell/documentation/protect-item.md +120 -0
- package/dist/tools/powershell/documentation/publish-item.md +224 -0
- package/dist/tools/powershell/documentation/read-variable.md +252 -0
- package/dist/tools/powershell/documentation/receive-file.md +244 -0
- package/dist/tools/powershell/documentation/receive-itemclonenotification.md +116 -0
- package/dist/tools/powershell/documentation/receive-scriptsession.md +108 -0
- package/dist/tools/powershell/documentation/remove-archiveitem.md +125 -0
- package/dist/tools/powershell/documentation/remove-basetemplate.md +137 -0
- package/dist/tools/powershell/documentation/remove-domain.md +70 -0
- package/dist/tools/powershell/documentation/remove-itemversion.md +209 -0
- package/dist/tools/powershell/documentation/remove-layout.md +151 -0
- package/dist/tools/powershell/documentation/remove-placeholdersetting.md +478 -0
- package/dist/tools/powershell/documentation/remove-rendering.md +253 -0
- package/dist/tools/powershell/documentation/remove-renderingparameter.md +83 -0
- package/dist/tools/powershell/documentation/remove-role.md +70 -0
- package/dist/tools/powershell/documentation/remove-rolemember.md +79 -0
- package/dist/tools/powershell/documentation/remove-scriptsession.md +72 -0
- package/dist/tools/powershell/documentation/remove-searchindexitem.md +79 -0
- package/dist/tools/powershell/documentation/remove-session.md +77 -0
- package/dist/tools/powershell/documentation/remove-user.md +97 -0
- package/dist/tools/powershell/documentation/reset-itemfield.md +149 -0
- package/dist/tools/powershell/documentation/reset-layout.md +130 -0
- package/dist/tools/powershell/documentation/restart-application.md +30 -0
- package/dist/tools/powershell/documentation/restore-archiveitem.md +126 -0
- package/dist/tools/powershell/documentation/resume-searchindex.md +84 -0
- package/dist/tools/powershell/documentation/send-file.md +160 -0
- package/dist/tools/powershell/documentation/send-sheermessage.md +66 -0
- package/dist/tools/powershell/documentation/set-hostproperty.md +90 -0
- package/dist/tools/powershell/documentation/set-itemacl.md +158 -0
- package/dist/tools/powershell/documentation/set-itemtemplate.md +156 -0
- package/dist/tools/powershell/documentation/set-layout.md +166 -0
- package/dist/tools/powershell/documentation/set-rendering.md +213 -0
- package/dist/tools/powershell/documentation/set-renderingparameter.md +97 -0
- package/dist/tools/powershell/documentation/set-user.md +221 -0
- package/dist/tools/powershell/documentation/set-userpassword.md +109 -0
- package/dist/tools/powershell/documentation/show-alert.md +53 -0
- package/dist/tools/powershell/documentation/show-application.md +150 -0
- package/dist/tools/powershell/documentation/show-confirm.md +61 -0
- package/dist/tools/powershell/documentation/show-fieldeditor.md +231 -0
- package/dist/tools/powershell/documentation/show-input.md +129 -0
- package/dist/tools/powershell/documentation/show-listview.md +276 -0
- package/dist/tools/powershell/documentation/show-modaldialog.md +137 -0
- package/dist/tools/powershell/documentation/show-result.md +158 -0
- package/dist/tools/powershell/documentation/show-yesnocancel.md +92 -0
- package/dist/tools/powershell/documentation/start-scriptsession.md +230 -0
- package/dist/tools/powershell/documentation/start-taskschedule.md +124 -0
- package/dist/tools/powershell/documentation/stop-scriptsession.md +78 -0
- package/dist/tools/powershell/documentation/stop-searchindex.md +84 -0
- package/dist/tools/powershell/documentation/suspend-searchindex.md +84 -0
- package/dist/tools/powershell/documentation/switch-rendering.md +248 -0
- package/dist/tools/powershell/documentation/test-account.md +74 -0
- package/dist/tools/powershell/documentation/test-basetemplate.md +97 -0
- package/dist/tools/powershell/documentation/test-itemacl.md +182 -0
- package/dist/tools/powershell/documentation/test-rule.md +111 -0
- package/dist/tools/powershell/documentation/unlock-item.md +124 -0
- package/dist/tools/powershell/documentation/unlock-user.md +84 -0
- package/dist/tools/powershell/documentation/unprotect-item.md +124 -0
- package/dist/tools/powershell/documentation/update-itemreferrer.md +234 -0
- package/dist/tools/powershell/documentation/update-listview.md +139 -0
- package/dist/tools/powershell/documentation/update-searchindexitem.md +79 -0
- package/dist/tools/powershell/documentation/wait-scriptsession.md +100 -0
- package/dist/tools/powershell/documentation/write-log.md +82 -0
- package/dist/tools/powershell/get-powershell-documentation.d.ts +2 -0
- package/dist/tools/powershell/get-powershell-documentation.js +47 -0
- package/dist/tools/powershell/get-powershell-documentation.js.map +1 -0
- package/dist/tools/powershell/run-powershell-script.d.ts +3 -0
- package/dist/tools/powershell/run-powershell-script.js +13 -0
- package/dist/tools/powershell/run-powershell-script.js.map +1 -0
- package/dist/tools/sitecore-cli/get-sitecore-cli-documentation.d.ts +3 -0
- package/dist/tools/sitecore-cli/get-sitecore-cli-documentation.js +24 -0
- package/dist/tools/sitecore-cli/get-sitecore-cli-documentation.js.map +1 -0
- package/dist/tools/sitecore-cli/sitecore-cli-documentation.md +70 -0
- package/package.json +8 -8
|
@@ -0,0 +1,718 @@
|
|
|
1
|
+
# Find-Item
|
|
2
|
+
|
|
3
|
+
Finds items using the Sitecore Content Search API.
|
|
4
|
+
|
|
5
|
+
## Syntax
|
|
6
|
+
|
|
7
|
+
```powershell
|
|
8
|
+
Find-Item [-Index] <String> [-Criteria <SearchCriteria[]>] [-QueryType <Type>] [-OrderBy <String>] [-First <Int32>] [-Last <Int32>] [-Skip <Int32>] [<CommonParameters>]
|
|
9
|
+
Find-Item [-Index] <String> [-Where <String>] [-WhereValues <Object[]>] [-Filter <String>] [-FilterValues <Object[]>] [-FacetOn <String[]>] [-FacetMinCount <Int32>] [-QueryType <Type>] [-OrderBy <String>] [-First <Int32>] [-Last <Int32>] [-Skip <Int32>] [<CommonParameters>]
|
|
10
|
+
Find-Item [-Index] <String> [-WherePredicate <Expression<Func<SearchResultItem, bool>>>] [-FilterPredicate <Expression<Func<SearchResultItem, bool>>>] [-QueryType <Type>] [-OrderBy <String>] [-First <Int32>] [-Last <Int32>] [-Skip <Int32>] [<CommonParameters>]
|
|
11
|
+
Find-Item [-Index] <String> [-ScopeQuery <String>] [-QueryType <Type>] [-OrderBy <String>] [-First <Int32>] [-Last <Int32>] [-Skip <Int32>] [<CommonParameters>]
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Detailed Description
|
|
15
|
+
|
|
16
|
+
The Find-Item command searches for items using the Sitecore Content Search API. The type `SearchResultItem` is used as the type when working with `IQueryable`.
|
|
17
|
+
|
|
18
|
+
© 2010-2020 Adam Najmanowicz, Michael West. All rights reserved. Sitecore PowerShell Extensions
|
|
19
|
+
|
|
20
|
+
## Parameters
|
|
21
|
+
|
|
22
|
+
### -Index <String>
|
|
23
|
+
|
|
24
|
+
Name of the Index that will be used for the search:
|
|
25
|
+
|
|
26
|
+
Find-Item -Index sitecore\_master\_index -First 10
|
|
27
|
+
|
|
28
|
+
| Aliases | |
|
|
29
|
+
| :--- | :--- |
|
|
30
|
+
| Required? | true |
|
|
31
|
+
| Position? | 1 |
|
|
32
|
+
| Default Value | |
|
|
33
|
+
| Accept Pipeline Input? | false |
|
|
34
|
+
| Accept Wildcard Characters? | false |
|
|
35
|
+
|
|
36
|
+
### -Criteria <SearchCriteria\[\]>
|
|
37
|
+
|
|
38
|
+
Simple form of search in which logical "AND" operations are needed.
|
|
39
|
+
|
|
40
|
+
```powershell
|
|
41
|
+
@{ Filter = "Equals"; Field = "_templatename"; Value = "Sample Item"; },
|
|
42
|
+
@{ Filter = "DescendantOf"; Value = (Get-Item "master:/content/") }
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Where "Filter" is one of the following values:
|
|
46
|
+
|
|
47
|
+
* Equals
|
|
48
|
+
* StartsWith
|
|
49
|
+
* Contains
|
|
50
|
+
* ContainsAny
|
|
51
|
+
* ContainsAll
|
|
52
|
+
* EndsWith
|
|
53
|
+
* DescendantOf - performs a _Contains_ with the field **\_path**
|
|
54
|
+
* Fuzzy
|
|
55
|
+
* InclusiveRange - performs a _Between_ using `int`, `double`, `datetime`, and `string`types
|
|
56
|
+
* ExclusiveRange - same as _InclusiveRange_
|
|
57
|
+
* MatchesRegex - use something like `^.*$`
|
|
58
|
+
* MatchesWildcard - use something like `H?li*m`
|
|
59
|
+
* LessThan
|
|
60
|
+
* GreaterThan
|
|
61
|
+
|
|
62
|
+
Where "Field" is the Index Field name found on the `SearchResultItem` such as the following:
|
|
63
|
+
|
|
64
|
+
* \_\_smallcreateddate - CreatedDate
|
|
65
|
+
* \_\_smallupdateddate - Updated
|
|
66
|
+
* \_group - ID
|
|
67
|
+
* \_template - TemplateId
|
|
68
|
+
* \_templatename - TemplateName
|
|
69
|
+
* \_fullpath - Path
|
|
70
|
+
|
|
71
|
+
Where "Value" is one of the following:
|
|
72
|
+
|
|
73
|
+
* string
|
|
74
|
+
* string\[\]
|
|
75
|
+
* Sitecore.Data.ID
|
|
76
|
+
* Sitecore.Data.Items.Item
|
|
77
|
+
* Sitecore.Data.Items.Item\[\]
|
|
78
|
+
* object\[\] - when using `@()` you'll get this type, which will be treated as an array of strings
|
|
79
|
+
* PSObject\[\]
|
|
80
|
+
* System.Collections.ArrayList
|
|
81
|
+
* System.Collections.Generics.List<string>
|
|
82
|
+
|
|
83
|
+
Where "Boost" is a positive number greater than 0
|
|
84
|
+
|
|
85
|
+
Fields by which you can filter can be discovered using the following script:
|
|
86
|
+
|
|
87
|
+
```powershell
|
|
88
|
+
$criteria = @(
|
|
89
|
+
@{Filter = "StartsWith"; Field = "_fullpath"; Value = "/sitecore/content/" }
|
|
90
|
+
)
|
|
91
|
+
$props = @{
|
|
92
|
+
Index = "sitecore_master_index"
|
|
93
|
+
Criteria = $criteria
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
Find-Item @props -First 1 | Select-Object -Expand "Fields"
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
Where "Invert" is a boolean to indicate the following:
|
|
100
|
+
|
|
101
|
+
* $false - This is the default value. Do exactly as the query is defined.
|
|
102
|
+
* $true - Reverse the logic. For example, "Contains" is treated like "NotContains", "Equals" is treated like "NotEquals".
|
|
103
|
+
|
|
104
|
+
| Aliases | |
|
|
105
|
+
| :--- | :--- |
|
|
106
|
+
| Required? | false |
|
|
107
|
+
| Position? | named |
|
|
108
|
+
| Default Value | |
|
|
109
|
+
| Accept Pipeline Input? | false |
|
|
110
|
+
| Accept Wildcard Characters? | false |
|
|
111
|
+
|
|
112
|
+
### -Where <String>
|
|
113
|
+
|
|
114
|
+
Where the "Where" is the Dynamic Linq query and "WhereValues" includes the array of values to be replaced in the query.
|
|
115
|
+
|
|
116
|
+
```powershell
|
|
117
|
+
$props = @{
|
|
118
|
+
Index = "sitecore_master_index"
|
|
119
|
+
Where = 'TemplateName = @0 And Language=@1'
|
|
120
|
+
WhereValues = "Sample Item", "en"
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
Find-Item @props
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
Filtering Criteria using Dynamic Linq syntax: [https://weblogs.asp.net/scottgu/dynamic-linq-part-1-using-the-linq-dynamic-query-library](https://weblogs.asp.net/scottgu/dynamic-linq-part-1-using-the-linq-dynamic-query-library)
|
|
127
|
+
|
|
128
|
+
| Aliases | |
|
|
129
|
+
| :--- | :--- |
|
|
130
|
+
| Required? | false |
|
|
131
|
+
| Position? | named |
|
|
132
|
+
| Default Value | |
|
|
133
|
+
| Accept Pipeline Input? | false |
|
|
134
|
+
| Accept Wildcard Characters? | false |
|
|
135
|
+
|
|
136
|
+
### -WhereValues <Object\[\]>
|
|
137
|
+
|
|
138
|
+
An Array of objects for Dynamic Linq "-Where" parameter as explained in: [https://weblogs.asp.net/scottgu/dynamic-linq-part-1-using-the-linq-dynamic-query-library](https://weblogs.asp.net/scottgu/dynamic-linq-part-1-using-the-linq-dynamic-query-library)
|
|
139
|
+
|
|
140
|
+
| Aliases | |
|
|
141
|
+
| :--- | :--- |
|
|
142
|
+
| Required? | false |
|
|
143
|
+
| Position? | named |
|
|
144
|
+
| Default Value | |
|
|
145
|
+
| Accept Pipeline Input? | false |
|
|
146
|
+
| Accept Wildcard Characters? | false |
|
|
147
|
+
|
|
148
|
+
### -Filter <String>
|
|
149
|
+
|
|
150
|
+
Where the "Filter" is the Dynamic Linq query and "FilterValues" includes the array of values to be replaced in the query.
|
|
151
|
+
|
|
152
|
+
| Aliases | |
|
|
153
|
+
| :--- | :--- |
|
|
154
|
+
| Required? | false |
|
|
155
|
+
| Position? | named |
|
|
156
|
+
| Default Value | |
|
|
157
|
+
| Accept Pipeline Input? | false |
|
|
158
|
+
| Accept Wildcard Characters? | false |
|
|
159
|
+
|
|
160
|
+
### -FilterValues <Object\[\]>
|
|
161
|
+
|
|
162
|
+
| Aliases | |
|
|
163
|
+
| :--- | :--- |
|
|
164
|
+
| Required? | false |
|
|
165
|
+
| Position? | named |
|
|
166
|
+
| Default Value | |
|
|
167
|
+
| Accept Pipeline Input? | false |
|
|
168
|
+
| Accept Wildcard Characters? | false |
|
|
169
|
+
|
|
170
|
+
### -WherePredicate <Expression<Func<SearchResultItem,bool>>>
|
|
171
|
+
|
|
172
|
+
Use the `New-SearchPredicate` command to build the appropriate predicates.
|
|
173
|
+
|
|
174
|
+
| Aliases | |
|
|
175
|
+
| :--- | :--- |
|
|
176
|
+
| Required? | false |
|
|
177
|
+
| Position? | named |
|
|
178
|
+
| Default Value | |
|
|
179
|
+
| Accept Pipeline Input? | false |
|
|
180
|
+
| Accept Wildcard Characters? | false |
|
|
181
|
+
|
|
182
|
+
### -FilterPredicate <Expression<Func<SearchResultItem,bool>>>
|
|
183
|
+
|
|
184
|
+
Use the `New-SearchPredicate` command to build the appropriate predicates.
|
|
185
|
+
|
|
186
|
+
| Aliases | |
|
|
187
|
+
| :--- | :--- |
|
|
188
|
+
| Required? | false |
|
|
189
|
+
| Position? | named |
|
|
190
|
+
| Default Value | |
|
|
191
|
+
| Accept Pipeline Input? | false |
|
|
192
|
+
| Accept Wildcard Characters? | false |
|
|
193
|
+
|
|
194
|
+
### -ScopeQuery <String>
|
|
195
|
+
|
|
196
|
+
When combined with the Query Builder field, a simple query can be crafted to return search results.
|
|
197
|
+
|
|
198
|
+
| Aliases | |
|
|
199
|
+
| :--- | :--- |
|
|
200
|
+
| Required? | false |
|
|
201
|
+
| Position? | named |
|
|
202
|
+
| Default Value | |
|
|
203
|
+
| Accept Pipeline Input? | false |
|
|
204
|
+
| Accept Wildcard Characters? | false |
|
|
205
|
+
|
|
206
|
+
### -OrderBy <String>
|
|
207
|
+
|
|
208
|
+
Field by which the search results sorting should be performed. This is the .Net Property name as see on the SearchResultItem class. Dynamic Linq ordering syntax used. [https://weblogs.asp.net/scottgu/dynamic-linq-part-1-using-the-linq-dynamic-query-library](https://weblogs.asp.net/scottgu/dynamic-linq-part-1-using-the-linq-dynamic-query-library)
|
|
209
|
+
|
|
210
|
+
| Aliases | |
|
|
211
|
+
| :--- | :--- |
|
|
212
|
+
| Required? | false |
|
|
213
|
+
| Position? | named |
|
|
214
|
+
| Default Value | |
|
|
215
|
+
| Accept Pipeline Input? | false |
|
|
216
|
+
| Accept Wildcard Characters? | false |
|
|
217
|
+
|
|
218
|
+
### -First <Int32>
|
|
219
|
+
|
|
220
|
+
Number of returned search results.
|
|
221
|
+
|
|
222
|
+
| Aliases | |
|
|
223
|
+
| :--- | :--- |
|
|
224
|
+
| Required? | false |
|
|
225
|
+
| Position? | named |
|
|
226
|
+
| Default Value | |
|
|
227
|
+
| Accept Pipeline Input? | false |
|
|
228
|
+
| Accept Wildcard Characters? | false |
|
|
229
|
+
|
|
230
|
+
### -Last <Int32>
|
|
231
|
+
|
|
232
|
+
| Aliases | |
|
|
233
|
+
| :--- | :--- |
|
|
234
|
+
| Required? | false |
|
|
235
|
+
| Position? | named |
|
|
236
|
+
| Default Value | |
|
|
237
|
+
| Accept Pipeline Input? | false |
|
|
238
|
+
| Accept Wildcard Characters? | false |
|
|
239
|
+
|
|
240
|
+
### -Skip <Int32>
|
|
241
|
+
|
|
242
|
+
Number of search results to be skipped skip before returning the results commences.
|
|
243
|
+
|
|
244
|
+
| Aliases | |
|
|
245
|
+
| :--- | :--- |
|
|
246
|
+
| Required? | false |
|
|
247
|
+
| Position? | named |
|
|
248
|
+
| Default Value | |
|
|
249
|
+
| Accept Pipeline Input? | false |
|
|
250
|
+
| Accept Wildcard Characters? | false |
|
|
251
|
+
|
|
252
|
+
### -Property <String\[\]>
|
|
253
|
+
|
|
254
|
+
An array of property names which match with the `SearchResultItem` type.
|
|
255
|
+
|
|
256
|
+
**Note:** The use of `Initialize-Item` is not supported because the object returned is no longer a `SearchResultItem` and therefore unable to guarantee that `Item` objects can be returned. [#1123](https://github.com/SitecorePowerShell/Console/issues/1123)
|
|
257
|
+
|
|
258
|
+
| Aliases | |
|
|
259
|
+
| :--- | :--- |
|
|
260
|
+
| Required? | false |
|
|
261
|
+
| Position? | named |
|
|
262
|
+
| Default Value | |
|
|
263
|
+
| Accept Pipeline Input? | false |
|
|
264
|
+
| Accept Wildcard Characters? | false |
|
|
265
|
+
|
|
266
|
+
## Outputs
|
|
267
|
+
|
|
268
|
+
The output type is the type of the objects that the cmdlet emits.
|
|
269
|
+
|
|
270
|
+
* Sitecore.ContentSearch.SearchTypes.SearchResultItem
|
|
271
|
+
|
|
272
|
+
## Notes
|
|
273
|
+
|
|
274
|
+
Help Author: Adam Najmanowicz, Michael West
|
|
275
|
+
|
|
276
|
+
## Examples
|
|
277
|
+
|
|
278
|
+
### EXAMPLE 1
|
|
279
|
+
|
|
280
|
+
Fields by which filtering can be performed using the -Criteria parameter.
|
|
281
|
+
|
|
282
|
+
```powershell
|
|
283
|
+
$criteria = @(
|
|
284
|
+
@{Filter = "Equals"; Field = "_templatename"; Value = "Sample Item"},
|
|
285
|
+
@{Filter = "Contains"; Field = "Title"; Value = "Sitecore"},
|
|
286
|
+
@{Filter = "Contains"; Field = "Title"; Value = "Powerful ways"; "Invert" = $true}
|
|
287
|
+
)
|
|
288
|
+
$props = @{
|
|
289
|
+
Index = "sitecore_master_index"
|
|
290
|
+
Criteria = $criteria
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
Find-Item @props
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
### EXAMPLE 2
|
|
297
|
+
|
|
298
|
+
Find items using a search built by the Query Builder field.
|
|
299
|
+
|
|
300
|
+
```powershell
|
|
301
|
+
$props = @{
|
|
302
|
+
Index = "sitecore_master_index"
|
|
303
|
+
ScopeQuery = "location:{110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9};custom:title|Sitecore"
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
Find-Item @props
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
### EXAMPLE 3
|
|
310
|
+
|
|
311
|
+
Find all items of template "Sample Item" which are in "English" under the "Home" item using Dynamic LINQ syntax.
|
|
312
|
+
|
|
313
|
+
```powershell
|
|
314
|
+
$templateId = [ID]::Parse("{76036F5E-CBCE-46D1-AF0A-4143F9B557AA}")
|
|
315
|
+
$homeId = [ID]::Parse("{110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9}")
|
|
316
|
+
$language = "en"
|
|
317
|
+
|
|
318
|
+
$props = @{
|
|
319
|
+
Index = "sitecore_master_index"
|
|
320
|
+
Where = 'TemplateId = @0 And Language=@1 And Paths.Contains(@2)'
|
|
321
|
+
WhereValues = $templateId, $language, $homeId
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
Find-Item @props
|
|
325
|
+
```
|
|
326
|
+
|
|
327
|
+
### EXAMPLE 4
|
|
328
|
+
|
|
329
|
+
Find items using a complex search predicate.
|
|
330
|
+
|
|
331
|
+
```powershell
|
|
332
|
+
$criteriaTemplate = @(
|
|
333
|
+
@{Filter = "Equals"; Field = "_templatename"; Value = "Template Field"; },
|
|
334
|
+
@{Filter = "Equals"; Field = "_templatename"; Value = "Sample Item"; Boost=25; },
|
|
335
|
+
@{Filter = "Equals"; Field = "_templatename"; Value = "Sample Content"; }
|
|
336
|
+
)
|
|
337
|
+
|
|
338
|
+
$predicateTemplate = New-SearchPredicate -Operation Or -Criteria $criteriaTemplate
|
|
339
|
+
|
|
340
|
+
$criteriaContent = @{Filter = "Contains"; Field = "Title"; Value = 'Sitecore'}
|
|
341
|
+
$predicateTitle = New-SearchPredicate -Criteria $criteriaContent
|
|
342
|
+
|
|
343
|
+
$predicateTemplateAndTitle = New-SearchPredicate -First $predicateTemplate -Second $predicateTitle -Operation And
|
|
344
|
+
|
|
345
|
+
$root = Get-Item -Path "master:" -ID "{110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9}"
|
|
346
|
+
$criteriaRoot = @{Filter = "DescendantOf"; Value = $root }
|
|
347
|
+
$predicateRoot = New-SearchPredicate -Criteria $criteriaRoot
|
|
348
|
+
|
|
349
|
+
$predicate = New-SearchPredicate -First $predicateRoot -Second $predicateTemplateAndTitle -Operation And
|
|
350
|
+
|
|
351
|
+
$props = @{
|
|
352
|
+
Index = "sitecore_master_index"
|
|
353
|
+
WherePredicate = $predicate
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
Find-Item @props
|
|
357
|
+
```
|
|
358
|
+
|
|
359
|
+
### EXAMPLE 5
|
|
360
|
+
|
|
361
|
+
Find items using logical AND conditions with ContainsAny. Demonstrates that different array types are handled.
|
|
362
|
+
|
|
363
|
+
**Note:** When searching for `ID`s you can use the proper type like `[ID[]]@("{C852E80E-ED49-4354-A397-6F66487F0E26}")` so SPE will handle the conversion to `ShortID`.
|
|
364
|
+
|
|
365
|
+
```powershell
|
|
366
|
+
$criteria = @(
|
|
367
|
+
@{Filter = "Equals"; Field = "_templatename"; Value = "Sample Content"; Boost=25; },
|
|
368
|
+
@{Filter = "ContainsAny"; Field = "Title"; Value = [string[]]@('$name','$date')},
|
|
369
|
+
@{Filter = "ContainsAny"; Field = "Title"; Value = @('$name','$date')},
|
|
370
|
+
@{Filter = "ContainsAny"; Field = "Title"; Value = [System.Collections.ArrayList]@('$name','$date')},
|
|
371
|
+
@{Filter = "ContainsAny"; Field = "Title"; Value = [System.Collections.Generic.List[string]]@('$name','$date')}
|
|
372
|
+
)
|
|
373
|
+
$props = @{
|
|
374
|
+
Index = "sitecore_master_index"
|
|
375
|
+
Criteria = $criteria
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
Find-Item @props
|
|
379
|
+
```
|
|
380
|
+
|
|
381
|
+
### EXAMPLE 6
|
|
382
|
+
|
|
383
|
+
Find items using logical AND with ContainsAll. Demonstrates looking in multilist fields.
|
|
384
|
+
|
|
385
|
+
```powershell
|
|
386
|
+
$criteria = @(
|
|
387
|
+
@{Filter = "Equals"; Field = "_templatename"; Value = "Sample Content"; Boost=25; },
|
|
388
|
+
@{Filter = "ContainsAll"; Field = "RelatedImages"; Value = @('{4D427A1D-312D-4EEE-A519-1F5700675BAF}','{4B603402-62AB-4ECB-9CAE-98790DDBC35A}')}
|
|
389
|
+
)
|
|
390
|
+
$props = @{
|
|
391
|
+
Index = "sitecore_master_index"
|
|
392
|
+
Criteria = $criteria
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
Find-Item @props
|
|
396
|
+
```
|
|
397
|
+
|
|
398
|
+
### EXAMPLE 7
|
|
399
|
+
|
|
400
|
+
Find an item by ID.
|
|
401
|
+
|
|
402
|
+
```powershell
|
|
403
|
+
$criteria = @(
|
|
404
|
+
@{Filter = "Equals"; Field = "_group"; Value = "{C89D37FF-3919-4D69-9925-943B67BD22D6}"}
|
|
405
|
+
)
|
|
406
|
+
$props = @{
|
|
407
|
+
Index = "sitecore_master_index"
|
|
408
|
+
Criteria = $criteria
|
|
409
|
+
}
|
|
410
|
+
Find-Item @props
|
|
411
|
+
```
|
|
412
|
+
|
|
413
|
+
### EXAMPLE 8
|
|
414
|
+
|
|
415
|
+
Find items within a data range. Possible filters are `InclusiveRange` and `ExclusiveRange` . When using dates, only **yyyyMMdd** is considered in the comparison so no need to get too precise.
|
|
416
|
+
|
|
417
|
+
```powershell
|
|
418
|
+
$props = @{
|
|
419
|
+
Index = "sitecore_master_index"
|
|
420
|
+
Criteria = @{
|
|
421
|
+
Field = "__smallcreateddate"
|
|
422
|
+
Filter = "InclusiveRange"
|
|
423
|
+
Value = [datetime[]]@([datetime]"01/05/2015", [datetime]::Today)
|
|
424
|
+
}, @{
|
|
425
|
+
Field = "_name"
|
|
426
|
+
Filter = "Fuzzy"
|
|
427
|
+
Value = "sample"
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
Find-Item @props
|
|
432
|
+
```
|
|
433
|
+
|
|
434
|
+
### EXAMPLE 9
|
|
435
|
+
|
|
436
|
+
Find and count all items beneath a root item using the item path.
|
|
437
|
+
|
|
438
|
+
```powershell
|
|
439
|
+
$criteria = @(
|
|
440
|
+
@{Filter = "Contains"; Field = "_fullpath"; Value = "/sitecore/content/home"},
|
|
441
|
+
@{Filter = "Equals"; Field = "_latestversion"; Value = "1"}
|
|
442
|
+
)
|
|
443
|
+
$props = @{
|
|
444
|
+
Index = "sitecore_master_index"
|
|
445
|
+
Criteria = $criteria
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
Find-Item @props | Measure-Object
|
|
449
|
+
```
|
|
450
|
+
|
|
451
|
+
### EXAMPLE 10
|
|
452
|
+
|
|
453
|
+
Find and count all items beneath a root item using the item id.
|
|
454
|
+
|
|
455
|
+
```powershell
|
|
456
|
+
$criteria = @(
|
|
457
|
+
@{Filter = "Contains"; Field = "_path"; Value = "{110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9}"},
|
|
458
|
+
@{Filter = "Equals"; Field = "_latestversion"; Value = "1"}
|
|
459
|
+
)
|
|
460
|
+
$props = @{
|
|
461
|
+
Index = "sitecore_master_index"
|
|
462
|
+
Criteria = $criteria
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
Find-Item @props | Measure-Object
|
|
466
|
+
```
|
|
467
|
+
|
|
468
|
+
### EXAMPLE 11
|
|
469
|
+
|
|
470
|
+
Find items and sort (boost) based on the date field. If this were used on a field containing future dates you should expect to see them mixed with past dates. This example demonstrates using Solr functions.
|
|
471
|
+
|
|
472
|
+
```powershell
|
|
473
|
+
$criteria = @(
|
|
474
|
+
@{Filter = "Equals"; Field = "_val_"; Value = "recip(abs(ms(NOW/HOUR,__smallcreateddate_tdt)),3.16e-11,4,.4)"}
|
|
475
|
+
)
|
|
476
|
+
$props = @{
|
|
477
|
+
Index = "sitecore_master_index"
|
|
478
|
+
Criteria = $criteria
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
Find-Item @props | Select-Object Name,CreatedDate
|
|
482
|
+
```
|
|
483
|
+
|
|
484
|
+
### EXAMPLE 12
|
|
485
|
+
|
|
486
|
+
Find items where the created date is older than the specified time in UTC.
|
|
487
|
+
|
|
488
|
+
```powershell
|
|
489
|
+
$date = New-Object DateTime 2019, 8, 1, 0, 0, 0, ([DateTimeKind]::Utc)
|
|
490
|
+
|
|
491
|
+
$criteria = @(
|
|
492
|
+
@{Filter = "LessThan"; Field = "__smallupdateddate"; Value = $date}
|
|
493
|
+
)
|
|
494
|
+
$props = @{
|
|
495
|
+
Index = "sitecore_master_index"
|
|
496
|
+
Criteria = $criteria
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
Find-Item @props
|
|
500
|
+
```
|
|
501
|
+
|
|
502
|
+
### EXAMPLE 13
|
|
503
|
+
|
|
504
|
+
Find items where the title contains the specified value. A custom implementation of `SearchResultItem` is used to enable the use of the property `Title` in the Dynamic Query.
|
|
505
|
+
|
|
506
|
+
```powershell
|
|
507
|
+
class TitleSearchResultItem : SearchResultItem
|
|
508
|
+
{
|
|
509
|
+
[Sitecore.ContentSearch.IndexField("title")]
|
|
510
|
+
[string]$Title
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
$props = @{
|
|
514
|
+
Index = "sitecore_master_index"
|
|
515
|
+
Where = "Title.Contains(@0)"
|
|
516
|
+
WhereValues = "great"
|
|
517
|
+
QueryType = [TitleSearchResultItem]
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
Find-Item @props
|
|
521
|
+
```
|
|
522
|
+
|
|
523
|
+
### EXAMPLE 14
|
|
524
|
+
|
|
525
|
+
Find items where the path contains the specified Id and base templates contain the specified Id using a Dynamic Query. A custom implementation of `SearchResultItem` is used to enable the use of the property `TemplateIds` in the Dynamic Query.
|
|
526
|
+
|
|
527
|
+
```powershell
|
|
528
|
+
class TemplatesSearchResultItem : SearchResultItem
|
|
529
|
+
{
|
|
530
|
+
# For items contained within an SXA index try using the name "inheritance_sm".
|
|
531
|
+
[Sitecore.ContentSearch.IndexField("_templates")]
|
|
532
|
+
[System.Collections.Generic.List[ID]]$TemplateIds
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
$props = @{
|
|
536
|
+
Index = "sitecore_master_index"
|
|
537
|
+
Where = "Paths.Contains(@0) And TemplateIds.Contains(@1)"
|
|
538
|
+
WhereValues = [ID]::Parse("{371EEE15-B6F3-423A-BB25-0B5CED860EEA}"), [ID]::Parse("{B0B6FB08-6BBE-43F2-8E36-FCE228325B63}")
|
|
539
|
+
QueryType = [TemplatesSearchResultItem]
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
Find-Item @props
|
|
543
|
+
```
|
|
544
|
+
|
|
545
|
+
### EXAMPLE 15
|
|
546
|
+
|
|
547
|
+
Find items where the title contains "Sitecore" using a Scope Query. A custom implementation of `SearchResultItem` is used to enable the use of the property `Title` in the Scope Query.
|
|
548
|
+
|
|
549
|
+
```powershell
|
|
550
|
+
class TitleSearchResultItem : SearchResultItem
|
|
551
|
+
{
|
|
552
|
+
[Sitecore.ContentSearch.IndexField("title")]
|
|
553
|
+
[string]$Title
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
$props = @{
|
|
557
|
+
Index = "sitecore_master_index"
|
|
558
|
+
ScopeQuery = "location:{110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9};custom:title|Sitecore"
|
|
559
|
+
QueryType = [TitleSearchResultItem]
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
Find-Item @props | Select-Object -Property Title
|
|
563
|
+
```
|
|
564
|
+
|
|
565
|
+
### EXAMPLE 16
|
|
566
|
+
|
|
567
|
+
Find items where the template is "Sample Content" and the title contains "Sitecore" and created by "admin" using the Criteria Query. A custom implementation of `SearchResultItem` is used to enable the use of the property `Title` and `Creator` in the Dynamic Query.
|
|
568
|
+
|
|
569
|
+
```powershell
|
|
570
|
+
class TitleSearchResultItem : SearchResultItem
|
|
571
|
+
{
|
|
572
|
+
[Sitecore.ContentSearch.IndexField("title")]
|
|
573
|
+
[string]$Title
|
|
574
|
+
[Sitecore.ContentSearch.IndexField("_creator")]
|
|
575
|
+
[string]$Creator
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
$criteria = @(
|
|
579
|
+
@{Filter = "Equals"; Field = "_templatename"; Value = "Sample Content"},
|
|
580
|
+
@{Filter = "Contains"; Field = "Title"; Value = "Sitecore"},
|
|
581
|
+
@{Filter = "Contains"; Field = "_creator"; Value = "admin"}
|
|
582
|
+
)
|
|
583
|
+
$props = @{
|
|
584
|
+
Index = "sitecore_master_index"
|
|
585
|
+
Criteria = $criteria
|
|
586
|
+
QueryType = [TitleSearchResultItem]
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
Find-Item @props
|
|
590
|
+
```
|
|
591
|
+
|
|
592
|
+
### EXAMPLE 17
|
|
593
|
+
|
|
594
|
+
Find items matching a complex query. A custom implementation of `SearchResultItem` is used to enable the use of the property `Title` in the Predicate Query.
|
|
595
|
+
|
|
596
|
+
```powershell
|
|
597
|
+
class TitleSearchResultItem : SearchResultItem
|
|
598
|
+
{
|
|
599
|
+
[Sitecore.ContentSearch.IndexField("title")]
|
|
600
|
+
[string]$Title
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
$criteriaTemplate = @{Filter = "Equals"; Field = "_templatename"; Value = "Template Field"; }, @{Filter = "Equals"; Field = "_templatename"; Value = "Sample Item"; Boost=25; }, @{Filter = "Equals"; Field = "_templatename"; Value = "Sample Content"; }
|
|
604
|
+
$predicateTemplate = New-SearchPredicate -Operation Or -Criteria $criteriaTemplate -QueryType ([TitleSearchResultItem])
|
|
605
|
+
|
|
606
|
+
$criteriaContent = @{Filter = "Contains"; Field = "Title"; Value = 'Sitecore'}
|
|
607
|
+
$predicateTitle = New-SearchPredicate -Criteria $criteriaContent -QueryType ([TitleSearchResultItem])
|
|
608
|
+
|
|
609
|
+
$predicateTemplateAndTitle = New-SearchPredicate -First $predicateTemplate -Second $predicateTitle -Operation And -QueryType ([TitleSearchResultItem])
|
|
610
|
+
|
|
611
|
+
$root = Get-Item -Path "master:" -ID "{110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9}"
|
|
612
|
+
$criteriaRoot = @{Filter = "DescendantOf"; Value = $root }
|
|
613
|
+
$predicateRoot = New-SearchPredicate -Criteria $criteriaRoot -QueryType ([TitleSearchResultItem])
|
|
614
|
+
|
|
615
|
+
$predicate = New-SearchPredicate -First $predicateRoot -Second $predicateTemplateAndTitle -Operation And -QueryType ([TitleSearchResultItem])
|
|
616
|
+
|
|
617
|
+
$props = @{
|
|
618
|
+
Index = "sitecore_master_index"
|
|
619
|
+
WherePredicate = $predicate
|
|
620
|
+
QueryType = [TitleSearchResultItem]
|
|
621
|
+
}
|
|
622
|
+
|
|
623
|
+
Find-Item @props
|
|
624
|
+
```
|
|
625
|
+
|
|
626
|
+
### EXAMPLE 18
|
|
627
|
+
|
|
628
|
+
Find items under the Content tree where the language is "en" and there are more than two occurrences. This could be used to find duplicate item names at the same path.
|
|
629
|
+
|
|
630
|
+
```powershell
|
|
631
|
+
$props = @{
|
|
632
|
+
Index = "sitecore_master_index"
|
|
633
|
+
Where = 'Paths.Contains(@0)'
|
|
634
|
+
WhereValues = [ID]::Parse("{0DE95AE4-41AB-4D01-9EB0-67441B7C2450}")
|
|
635
|
+
Filter = 'Language = @0'
|
|
636
|
+
FilterValues = "en"
|
|
637
|
+
FacetOn = "Path"
|
|
638
|
+
FacetMinCount = 2
|
|
639
|
+
}
|
|
640
|
+
|
|
641
|
+
Find-Item @props | Select-Object -Expand Categories | Select-Object -Expand Values
|
|
642
|
+
```
|
|
643
|
+
|
|
644
|
+
### EXAMPLE 19
|
|
645
|
+
|
|
646
|
+
Find the most recently updated item.
|
|
647
|
+
|
|
648
|
+
```powershell
|
|
649
|
+
$templateId = "{C382C7B8-7567-40CB-AE89-7F5680735D4E}"
|
|
650
|
+
$criteria = @(
|
|
651
|
+
@{Filter = "Equals"; Field = "_template"; Value = $templateId}
|
|
652
|
+
)
|
|
653
|
+
$props = @{
|
|
654
|
+
Index = "sitecore_master_index"
|
|
655
|
+
Criteria = $criteria
|
|
656
|
+
OrderBy = "Updated"
|
|
657
|
+
Last = 1
|
|
658
|
+
}
|
|
659
|
+
|
|
660
|
+
Find-Item @props | Select-Object -Property ItemId, Name, Path, Updated
|
|
661
|
+
```
|
|
662
|
+
|
|
663
|
+
### EXAMPLE 20
|
|
664
|
+
|
|
665
|
+
Find items where the expiration date has not passed (now to the future) or the expiration date is empty (never expires).
|
|
666
|
+
|
|
667
|
+
```powershell
|
|
668
|
+
$props = @{
|
|
669
|
+
Index = "sitecore_master_index"
|
|
670
|
+
ScopeQuery = "+location:{447D82A5-BDBD-4898-8598-D79B3EB9BE6D};+template:{51ED5851-1A61-4DAE-B803-6C7FAE6B43D8};custom:EventEndDate|[* TO NOW-100YEARS];custom:EventEndDate|[NOW TO *];"
|
|
671
|
+
}
|
|
672
|
+
|
|
673
|
+
Find-Item @props
|
|
674
|
+
```
|
|
675
|
+
|
|
676
|
+
### EXAMPLE 21
|
|
677
|
+
|
|
678
|
+
Use Skip and Take to page through results until all are returned.
|
|
679
|
+
|
|
680
|
+
```powershell
|
|
681
|
+
$criteria = @(
|
|
682
|
+
@{Filter = "Contains"; Field = "_fullpath"; Value = "/sitecore/content/home"},
|
|
683
|
+
@{Filter = "Equals"; Field = "_latestversion"; Value = "1"}
|
|
684
|
+
)
|
|
685
|
+
$props = @{
|
|
686
|
+
Index = "sitecore_master_index"
|
|
687
|
+
Criteria = $criteria
|
|
688
|
+
}
|
|
689
|
+
|
|
690
|
+
$searchItems = [System.Collections.ArrayList]@()
|
|
691
|
+
$pageSize = 250
|
|
692
|
+
$offset = 0
|
|
693
|
+
$keepGoing = $true
|
|
694
|
+
while($keepGoing) {
|
|
695
|
+
$pagedItems = @(Find-Item @props -Skip $offset -First $pageSize)
|
|
696
|
+
if($pagedItems) {
|
|
697
|
+
$lastCount = $pagedItems.Count
|
|
698
|
+
$offset += $lastCount
|
|
699
|
+
$searchItems.AddRange($pagedItems) > $null
|
|
700
|
+
} else {
|
|
701
|
+
$keepGoing = $false
|
|
702
|
+
}
|
|
703
|
+
}
|
|
704
|
+
|
|
705
|
+
$searchItems
|
|
706
|
+
|
|
707
|
+
```
|
|
708
|
+
|
|
709
|
+
## Related Topics
|
|
710
|
+
|
|
711
|
+
* [Initialize-Item](initialize-item.md)
|
|
712
|
+
* [https://gist.github.com/AdamNaj/273458beb3f2b179a0b6](https://gist.github.com/AdamNaj/273458beb3f2b179a0b6)
|
|
713
|
+
* [https://weblogs.asp.net/scottgu/dynamic-linq-part-1-using-the-linq-dynamic-query-library](https://weblogs.asp.net/scottgu/dynamic-linq-part-1-using-the-linq-dynamic-query-library)
|
|
714
|
+
* [#1128](https://github.com/SitecorePowerShell/Console/issues/1128) Added support for GreaterThan and LessThan
|
|
715
|
+
* [#1120](https://github.com/SitecorePowerShell/Console/issues/1120) Added support for custom `SearchResultItem` type
|
|
716
|
+
* [#1174](https://github.com/SitecorePowerShell/Console/issues/1174) Added support for Facet
|
|
717
|
+
* [#1176](https://github.com/SitecorePowerShell/Console/issues/1176) Added support for Filter
|
|
718
|
+
|