The Shared File Search module provides fuzzy matching and search functionality for managing shared files by name, allowing discovery and revocation without memorizing share reference IDs.
The Shared Search module enables finding and filtering shared files by:
- Exact filename matches
- Prefix matches
- Substring matches
- Fuzzy scoring for relevance
This makes it easy to locate shares for management without needing to remember or look up reference IDs.
The search algorithm uses weighted scoring:
| Match Type | Score | Example |
|---|---|---|
| Exact match | 0 (best) | report.pdf matches report.pdf |
| Prefix match | ~filename length | rep matches report.pdf |
| Substring match | ~100 + position | port matches report.pdf |
| No match | ∞ (excluded) | xyz doesn't match anything |
Results are sorted by score (lowest = best match):
- Exact matches first
- Prefix matches second
- Substring matches last
Search shared files with fuzzy matching.
Function Signature:
func FindSharedFilesByName(index *SharedIndex, pattern string) ([]*SharedFileMatch, error)Parameters:
index: Shared index to searchpattern: Search pattern (filename, path, or partial)
Returns:
- Slice of
SharedFileMatchstructs (sorted by score) - Error if search fails
type SharedFileMatch struct {
ShareID string
Filename string
VaultPath string
CreatedAt string
Score int
}Fields:
ShareID: Reference ID for the shareFilename: Original filenameVaultPath: Full vault pathCreatedAt: Creation timestampScore: Match quality (lower is better)
Display search results in formatted table.
Function Signature:
func PrintSharedFilesFormatted(matches []*SharedFileMatch)Parameters:
matches: Search results to display
Output Format:
ID FILENAME VAULT PATH CREATED
---- -------- ---------- -------
72cTWg report.pdf documents/reports/q1.pdf 2026-02-04
AbXkLm budget.xlsx financial/budget.xlsx 2026-02-03
List all shares or search by pattern.
Usage:
./zep shared ls [pattern]Aliases: shared list, shared find, shared search
Examples:
zep> shared ls
ID FILENAME VAULT PATH
---- -------- ----------
72cTWg report.pdf documents/reports/q1.pdf
AbXkLm budget.xlsx financial/budget.xlsxzep> shared ls reportOutput:
ID FILENAME VAULT PATH
---- -------- ----------
72cTWg report.pdf documents/reports/q1.pdf
zep> shared ls repOutput:
ID FILENAME VAULT PATH
---- -------- ----------
72cTWg report.pdf documents/reports/q1.pdf
zep> shared ls portOutput:
ID FILENAME VAULT PATH
---- -------- ----------
72cTWg report.pdf documents/reports/q1.pdf
zep> shared ls documentsOutput:
ID FILENAME VAULT PATH
---- -------- ----------
72cTWg report.pdf documents/reports/q1.pdf
Checks if pattern equals filename:
Pattern: "report.pdf"
Filename: "report.pdf"
Match: Yes (score 0)
Checks if filename starts with pattern:
Pattern: "report"
Filename: "report.pdf"
Match: Yes (score 6 = length of pattern)
Checks if pattern appears in filename:
Pattern: "port"
Filename: "report.pdf"
Match: Yes (score 104 = 100 + position)
All comparisons are case-insensitive:
Pattern: "REPORT"
Filename: "report.pdf"
Match: Yes (exact match, score 0)
Search for all PDFs:
zep> shared ls .pdf
ID FILENAME VAULT PATH
---- -------- ----------
72cTWg report.pdf documents/reports/q1.pdf
AbXkLm proposal.pdf projects/2024/proposal.pdfFind all shares from a specific project:
zep> shared ls 2024
ID FILENAME VAULT PATH
---- -------- ----------
AbXkLm q1_budget.xlsx 2024/financial/q1_budget.xlsx
Cd2nXp annual_plan.pdf 2024/planning/annual_plan.pdfSearch shares from a department:
zep> shared ls financial
ID FILENAME VAULT PATH
---- -------- ----------
AbXkLm budget.xlsx financial/budget.xlsxSearch progressively:
zep> shared ls report
# Shows 5 results
zep> shared ls report2024
# Shows 2 results
zep> shared ls report2024q
# Shows 1 result: report2024_q1.pdf# Find the share
zep> shared ls report
ID FILENAME
---- --------
72cTWg report.pdf
# Revoke it
zep> shared rm 72cTWg
✔ Revoked share: 72cTWg# Find by name
zep> shared ls budget
ID FILENAME
---- --------
AbXkLm budget.xlsx
# Get details
zep> shared info AbXkLm
Share ID: AbXkLm
Filename: budget.xlsx
Vault Path: financial/budget.xlsx
...# Find old version
zep> shared ls document
ID FILENAME
---- --------
72cTWg document.pdf (old)
# Revoke old
zep> shared rm 72cTWg
# Upload new version
zep> upload document-v2.pdf documents/document.pdf
# Share new version
zep> share documents/document.pdf- Time: O(n) where n = number of shares
- Space: O(m) where m = number of matches
- Typical: <1ms for <100 shares
If vault has many shares:
- Use specific patterns to narrow results
- Remember share ID for direct access
- Use full paths for unambiguous matches
Search only covers:
- Filenames
- Vault paths
- Does NOT search file contents
To revoke by reference (fastest):
zep> shared rm 72cTWg # Fast - direct lookup
zep> shared rm report # Slower - needs searchPattern matching is simple substring/prefix:
- No regex support
- No pattern wildcards
- Case-insensitive only
Future improvements could include:
- Regex pattern support
- Date range filtering
- Access count filtering
- Sort by creation date or size
- Export search results
- Bulk revocation of matching shares
- Shared Manage Module - Revoking shares
- Shared Index Module - Index structure
- Share Module - Creating shares
- Shared Files Overview