SearchFolder¶
The SearchFolder type represents a search folder in a PST file.
Type Definition¶
SearchFolder embeds Folder, so all Folder methods are available.
Creating a SearchFolder¶
SearchFolders are created from regular Folders:
Methods¶
SearchCriteria¶
Returns the search criteria for this search folder.
SearchCriteria Type¶
type SearchCriteria struct {
Restriction []byte // Raw restriction data
FolderEntryIDs [][]byte // Entry IDs of folders to search
SearchFlags uint32 // Search behavior flags
}
SearchCriteria Methods¶
IsRecursive¶
Returns true if the search includes subfolders.
IsForeground¶
Returns true if this is a foreground search.
IsStatic¶
Returns true if this is a static search (not updated).
UsesContentIndex¶
Returns true if the search uses content indexing.
PropertyBag¶
Returns the underlying property bag for advanced access.
Search Flags¶
| Constant | Value | Description |
|---|---|---|
SearchFlagForeground |
0x00000001 | Foreground search |
SearchFlagRecursive |
0x00000002 | Search subfolders |
SearchFlagContentIndex |
0x00000004 | Use content indexing |
SearchFlagStatic |
0x00000008 | Static search |
SearchFlagMaybeStatic |
0x00000010 | Might be static |
Example¶
func analyzeSearchFolder(folder *outlookpst.Folder) {
if !folder.IsSearchFolder() {
fmt.Println("Not a search folder")
return
}
sf := folder.AsSearchFolder()
name, _ := sf.Name()
fmt.Printf("Search Folder: %s\n", name)
criteria, err := sf.SearchCriteria()
if err != nil {
fmt.Printf("Error: %v\n", err)
return
}
fmt.Printf("Flags:\n")
fmt.Printf(" Recursive: %v\n", criteria.IsRecursive())
fmt.Printf(" Static: %v\n", criteria.IsStatic())
fmt.Printf(" Content Index: %v\n", criteria.UsesContentIndex())
fmt.Printf("Folders searched: %d\n", len(criteria.FolderEntryIDs))
fmt.Printf("Restriction size: %d bytes\n", len(criteria.Restriction))
// Count matching messages
count := 0
for _, err := range sf.Messages() {
if err == nil {
count++
}
}
fmt.Printf("Matching messages: %d\n", count)
}
SearchUpdateQueue¶
The SearchUpdateQueue tracks pending updates for search folders.
Type Definition¶
type SearchUpdateQueue struct {
// internal fields
}
type SearchUpdateEntry struct {
FolderNID util.NodeID
MessageNID util.NodeID
Flags uint32
}
Accessing the Queue¶
Methods¶
Entries¶
Returns all entries in the queue.
Count¶
Returns the number of entries.
IsEmpty¶
Returns true if the queue is empty.
Specification Reference¶
- [MS-PST] Section 2.4.8 - Search
- [MS-PST] Section 2.4.8.6 - Search Update Queue