shouldCreate returns if given index should be created.
(options InitializeIndexOptions)
| 272 | |
| 273 | // shouldCreate returns if given index should be created. |
| 274 | func (i *SGIndex) shouldCreate(options InitializeIndexOptions) bool { |
| 275 | if options.LegacySyncDocsIndex { |
| 276 | if i.creationMode == SeparatePrincipalIndexes { |
| 277 | return false |
| 278 | } |
| 279 | } else { |
| 280 | if i.creationMode == LegacySyncDocsIndex { |
| 281 | return false |
| 282 | } |
| 283 | |
| 284 | } |
| 285 | if i.isXattrOnly() && !options.UseXattrs { |
| 286 | return false |
| 287 | } |
| 288 | |
| 289 | if i.isMetadataOnly() && options.MetadataIndexes == IndexesWithoutMetadata { |
| 290 | return false |
| 291 | } |
| 292 | |
| 293 | if !i.isMetadataOnly() && options.MetadataIndexes == IndexesMetadataOnly { |
| 294 | return false |
| 295 | } |
| 296 | |
| 297 | if !i.isPrincipalOnly() && options.MetadataIndexes == IndexesPrincipalOnly { |
| 298 | return false |
| 299 | } |
| 300 | return true |
| 301 | } |
| 302 | |
| 303 | // Creates index associated with specified SGIndex if not already present. Always defers build - a subsequent BUILD INDEX |
| 304 | // will need to be invoked for any created indexes. |
no test coverage detected