Local file name & content search for Windows / macOS / Linux. Fast UI, read‑only indexing, multilingual search, wildcard filename queries, and live updates.
UI text is English. Code comments are Chinese. Minimum runtime: Java 8. Build with Maven.
- Overview
- Key Features
- Architecture
- Index Schema & Analyzers
- Search Semantics
- Indexing & Content Extraction
- Sources: Local vs Network
- UI & UX
- Build & Run
- Configuration
- Data Locations
- Troubleshooting
- Performance Notes
- Roadmap
- Contributing
- License
DocFinder is a desktop utility that lets you search file names and file contents with a responsive, Everything‑style UI. It uses Lucene for indexing/search, Tika for content extraction, and adds SmartChinese / Kuromoji analyzers to handle Chinese and Japanese text well. Indexing is read‑only (no touching timestamps or contents) and optimized with timeouts and heuristics.
-
Search
- Free text across filename and content (multi‑field query).
- Fielded search:
name:(filename‑only),content:(content‑only). - Wildcard filename queries:
name:*.xlsx,name:report-??.pdf,name:"チェックリスト_07.xlsx". - Leading wildcards enabled (e.g.,
*.xlsx). - Filters by extension and modified time.
- Multilingual: English + Chinese + Japanese analyzers.
- Query history: last 100 queries persisted (dropdown).
-
Results UI
- Columns: Name, Path, Score, Created, Last Accessed, Size, Match (
name/content/name + content). - Preview panel (read‑only; smaller font), with a top-right toggle to show/hide.
- Right‑click menu: Open, Open With… (remembers last choice), Reveal in Explorer/Finder, Copy Path/Name.
- Shortcuts: Enter (open), Ctrl+C (copy path), Ctrl+Shift+C (copy name).
- Columns: Name, Path, Score, Created, Last Accessed, Size, Match (
-
Indexing
- Read‑only extraction via Apache Tika; timeouts; size limits.
- Text‑like detection using extension allowlist, MIME probing, and heuristics; large/irrelevant binaries skipped.
- Rebuild Index (Full) menu to clean rebuild when schema changes.
-
Sources
Manage Sources…dialog with Local/Network type per folder, background detection.- Live Watch for Local sources (OS WatchService).
- Network Polling for Network sources (periodic snapshot/diff). Poll Network Sources Now runs in the background.
-
Platform niceties
- Global hotkey (via
jnativehook) to toggle main window. - System tray icon + menu; multi‑size PNG icons; Taskbar/Dock icon set at runtime.
- Robust Windows path handling (UNC, mapped drives,
¥on Japanese OS).
- Global hotkey (via
- UI: Swing (English strings). Main window shows search bar, results table, preview, and status bar. Menus: File (Index, Settings), Help (Usage, About). Tray icon and a global hotkey are integrated.
- Index: Lucene index stored under
./.docfinder/index. A single writer used per operation; multi‑root indexing iterates sources. - Extraction: Apache Tika with an executor + timeout (future cancel). Streams opened with
StandardOpenOption.READonly. - Watchers:
- Local: Java NIO
WatchServicefor create/modify/delete; coalesced and processed asynchronously. - Network: polling scheduler; snapshot/diff; back‑pressure to avoid UI blocking.
- Local: Java NIO
- Persistence: sources list
./.docfinder/sources.txt(path|0/1), query history, and app settings stored under./.docfinder/.
Lucene fields (per file):
path—StringField, normalized, stored. Primary key. All updates/deletes use the normalized value.name—TextField, stored. For analyzed filename matching and boosting.name_raw—StringField, lowercase & NOT analyzed. Enables exact/wildcard filename search vianame:.ext—StringField, stored. Used for filtering and wildcard acceleration.mtime_l—LongPoint. Range filter for modified time.mtime/ctime/atime—StoredField(for display).size—StoredField.mime—StringField, stored (best‑effort).content—TextField, not stored.content_zh—TextField, not stored (SmartChineseAnalyzer).content_ja—TextField, not stored (JapaneseAnalyzer / Kuromoji).
Analyzers (via PerFieldAnalyzerWrapper):
StandardAnalyzerfornameandcontent.SmartChineseAnalyzerforcontent_zh.JapaneseAnalyzer(Kuromoji) forcontent_ja.
Path normalization
- All writes/updates/deletes use
Utils.normalizeForIndex(Path)so thatpathterms are consistent across platforms and Windows variants (UNC, mapped drives,¥).
- Multi‑field parsing with boosts:
name^2.0,content^1.2,content_zh^1.2,content_ja^1.2. - Leading wildcards allowed in the parser.
- Filename wildcard handling:
- We pre‑extract
name:<pattern>(supports quotes). If the entire query is just a wildcard like*.xlsx, it’s treated as filename wildcard. - Patterns go to
name_rawviaWildcardQuery(orTermQueryif no*/?). - If the pattern is of the form
*.ext, we also add a MUSText:<ext>to narrow the candidate set (big speedup).
- We pre‑extract
- Prefix boost: when user typed a short ASCII token without field/space/wildcard, we add a
PrefixQuery(name, token)as a SHOULD to boost filename starts‑with matches. - Filters: extension OR‑set and modified‑time range are added as MUST clauses.
If upgrading from older indexes, run Rebuild Index (Full) once so all docs have
name_raw.
- Read‑only:
- Open files with
StandardOpenOption.READ. - Tika runs inside an executor with a configurable timeout (
IndexSettings.parseTimeoutSec). - On timeout/failure, we index metadata only (content fields omitted).
- Open files with
- What gets parsed is controlled by
IndexSettings:maxFileMBsize cap.includeExtdocument allowlist (e.g., pdf/docx/xlsx/pptx/html…).parseTextLiketoggle to parse text‑like files.textExtsfor source code / config (java, go, rs, py, js, ts, json, yaml/yml, xml, md, txt, sh, properties…).textMaxBytesapplies to all text-like parsing (including MIME/heuristic-detected text files with uncommon extensions).maxExtractCharscontrols maximum extracted characters per file before truncation.- MIME check (
text/*, commonapplication/*) and 4KB heuristic: no NUL and ASCII printable ratio ≥ 0.85.
- Storage:
./.docfinder/sources.txtwith lines ofpath|0/1(1 = Network). Old single‑column files are auto‑upgraded. - Detection (Windows): tries PowerShell
Get-PSDrive,net use,wmic, with caching; falls back toFileStoretype and UNC prefixes. Mapped drives (J:\,M:\) are treated as Network when resolved to remote targets. - Live Watch: enabled only for Local sources (uses NIO
WatchService). - Network Polling: enabled only for Network sources; background snapshots + diffs;
Poll Network Sources Nowis async and updates the status bar when done.
- Search field with placeholder hint (
Search… (e.g. report*, content:"zero knowledge", name:"設計")) and query history (100 recent, persisted). - Results table with sortable columns; preview pane on the right.
- Menu
File → Manage Sources…(manage sources with Local/Network type)File → Index All SourcesandFile → Rebuild Index (Full)File → Indexing Settings…File → Enable Web Server(toggle web interface, default port 7070)Help → Usage Guide,Help → About DocFinder
- Tray icon with context menu; Global hotkey toggles window.
- Icons: load multi‑size PNGs from
src/main/resources/icons/; Taskbar/Dock icon set viaTaskbar(Java 9+) orcom.apple.eawton macOS.
- Built-in web server provides browser-based access (default:
http://localhost:7070) - Self-contained preview system for viewing files directly in the browser:
- PDF files: Native browser PDF viewer (via iframe)
- Text/Code files: 50+ formats with syntax highlighting (txt, log, md, json, xml, yaml, py, js, java, go, rs, c, cpp, sh, etc.)
- Images: JPG, PNG, GIF, BMP, SVG, WebP, ICO
- Charset detection: Automatic detection for UTF-8, GBK, windows-1252, UTF-16
- File size limits: 512KB preview limit for text files
- Download fallback: All unsupported formats (Office docs, archives, media) provide download button
- Features:
- Dark/light theme toggle
- Resizable split pane
- Search history
- Share links to files
- Completely offline (no external dependencies)
- Supported preview formats:
- ✅ PDF (native browser viewer)
- ✅ Text/code files (50+ extensions with syntax highlighting)
- ✅ Images (common formats)
- ❌ Office documents (.doc, .docx, .xls, .xlsx, .ppt, .pptx) - download only
- ❌ Specialized formats (OFD, CAD, archives, media files) - download only
- Java 8+
- Maven 3.6+
mvn clean package# Shaded/assembly JAR (depending on your packaging)
java -jar target/docfinder-1.0.0.jarOr launch from IDE. The app uses
./.docfinderfor its runtime data.
<dependencies>
<!-- Lucene core + queryparser + analyzers -->
<dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-core</artifactId>
<version>${lucene.version}</version>
</dependency>
<dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-queryparser</artifactId>
<version>${lucene.version}</version>
</dependency>
<dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-analyzers-common</artifactId>
<version>${lucene.version}</version>
</dependency>
<dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-analyzers-smartcn</artifactId>
<version>${lucene.version}</version>
</dependency>
<dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-analyzers-kuromoji</artifactId>
<version>${lucene.version}</version>
</dependency>
<!-- Apache Tika -->
<dependency>
<groupId>org.apache.tika</groupId>
<artifactId>tika-core</artifactId>
<version>${tika.version}</version>
</dependency>
<dependency>
<groupId>org.apache.tika</groupId>
<artifactId>tika-parsers-standard-package</artifactId>
<version>${tika.version}</version>
</dependency>
<!-- Global hotkey -->
<dependency>
<groupId>com.github.kwhat</groupId>
<artifactId>jnativehook</artifactId>
<version>2.2.2</version>
</dependency>
</dependencies>Ensure Lucene/Tika versions are mutually compatible for your chosen major versions.
IndexSettings main fields:
maxFileMB— parse size capparseTimeoutSec— per‑file Tika timeoutmaxExtractChars— max extracted characters per file before truncationincludeExt— document‑type allowlist (e.g., pdf, docx, xlsx, pptx, html)parseTextLike— parse text‑like filestextMaxBytes— max bytes for text-like files (including unknown extensions detected by MIME/heuristics)textExts— text/source extensions (txt, md, json, yaml, xml, java, go, rs, py, js, ts, sh, properties…)excludeGlob— glob patterns to skip (e.g.,**/.git/**,**/node_modules/**)
ConfigManager web server settings:
web.enabled— enable/disable web server (default: false)web.port— web server port (default: 7070)web.bindAddress— bind address (default: 127.0.0.1)
- Index:
~/.docfinder/index/ - Sources:
~/.docfinder/sources.txt(path|0/1where1 = Network) - History & settings:
~/.docfinder/config.properties - Logs:
~/.docfinder/logs/docfinder.log - Web shares:
~/.docfinder/shares.properties(when using web interface)
name:チェックリスト_07.xlsxreturns nothing → reindex with Rebuild Index (Full) to ensure all docs havename_raw.- "Manage Sources…" seems slow → detection runs in background; upgrade to latest build if you still see blocking.
- "Poll Network Sources Now" shows no changes → verify the folder is marked Network and reachable; NAS may reflect updates with delay.
- Preview empty in desktop app → file too large/timeout/unsupported; increase timeout or extend allowlist.
- Web preview not working → ensure web server is enabled (
File → Enable Web Server); check browser console for errors; verify file permissions. - Web preview shows encoding issues → charset detection attempts UTF-8, GBK, windows-1252, and UTF-16; some rare encodings may not display correctly.
- Large text files don't preview → files over 512KB are truncated for browser performance; download the file to view completely.
- POI WARN logs (
XSSFDrawing/DataFormatter) → usually non-fatal format warnings from Office parsing; indexing can still succeed. Default logging suppresses these noisy categories. - Windows yen sign (¥) → internal normalization handles it; opening uses Explorer‑friendly paths.
- Wildcard
*.extis accelerated with anextMUST clause. - Prefix boosting improves relevance for short filename tokens.
- Index writer uses a larger RAM buffer for bulk indexing; adjust in code if needed.
- Content extraction uses timeouts and short‑circuit heuristics to skip obvious binaries.
- Path wildcards (
path:) and regex search. - Snippet highlighting in preview for content hits.
- UI theme polish (e.g., BeautyEye or similar) as an optional module.
- Export/import of settings and sources.
- Fork & branch from
main. - Build:
mvn clean package(Java 8+). - Code style: keep UI strings English, comments Chinese; avoid UI blocking (use
SwingWorkerfor heavy tasks). - Submit PR with a clear description and screenshots if UI changes are involved.
TBD (MIT/Apache‑2.0/Proprietary — choose one and add the license fil
- Logs: unified runtime logs are written to
./.docfinder/logs/docfinder.log, and can be opened from Help → View Log.