Uses 911K of libraries. Click here for Pure Java version (8389L/42K).
!7 sclass SearchResult { S snippetID; S title; int occurrences; sS _fieldOrder = "snippetID title occurrences"; } cmodule FullTextSnippetSearch > DynTableWithInput2<SearchResult> { switchable int maxResults = 1000; transient S status; JComponent mainComponent() { ret northAndCenterWithMargin(dm_rightAlignedLabel status(), super.mainComponent()); } start { dontPersist(); } void calc { S query = upper(input); S mod = dm_require("#1028945/CacheAllSnippets"); SS data = cast dm_rcall getData(mod); SS titles = cast dm_rcall getTitles(mod); new L<SearchResult> out; if (nempty(query)) { time "Full-Text Search" { fOr ping (S snippetID, text : data) { S title = titles.get(snippetID); int n = countOccurrencesIC(title, query) + countOccurrences_optimizedForZero(text, query); if (n > 0) { new SearchResult r; r.snippetID = snippetID; r.title = title; r.occurrences = n; out.add(r); if (l(out) >= maxResults) break; } } } } sortInPlaceByCalculatedFieldDesc(out, r -> r.occurrences); setField(status := empty(query) ? " " : "Found " + addPlusToCount(maxResults, l(out), nSnippets(out) + " in " + lastTiming() + " ms"); setList(out); } }
Began life as a copy of #1028144
download show line numbers debug dex old transpilations
Travelled to 7 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv
No comments. add comment
Snippet ID: | #1028948 |
Snippet name: | Instant Full-Text Snippet Search |
Eternal ID of this version: | #1028948/14 |
Text MD5: | b613036888966ef7bc6a65f4abd29525 |
Transpilation MD5: | 5700c76751359dfa825d2b4afb5ca987 |
Author: | stefan |
Category: | javax |
Type: | JavaX source code (Dynamic Module) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2020-07-12 20:30:50 |
Source code size: | 1435 bytes / 51 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 282 / 2743 |
Version history: | 13 change(s) |
Referenced in: | #1028975 - Instant Full-Text Snippet Search v2 [using word index, seems OK] |