mirror of
https://github.com/zotero/zotero.git
synced 2026-10-11 03:38:25 +00:00
Render search snippets in itemTree lazily, as the user scrolls to them. Fulltext table is contentless, so we cannot fetch snippet() for each search match. For embeddings, we need to fetch the structured-text to locate the right block. Both of these operations can take a long time when done to a lot of items in _refresh before rendering, which is why search snippets are extracted on demand. BestMatch.Session is a new object to wrap the interaction between the item tree and the search engines. BestMatch.Session.score returns the search results with an indication which of them should have search snippets. Not all search results do - purely semantic matches on abstracts or notes, as well as all matches on annotations get a snippet. ItemTree renders a placeholder child row for items that will have snippets. Based on the matches flag above, the itemTree renders placeholder rows. When the placeholder row is rendered, onSearchMatchRendered is called to tell BestMatch.Session which attachment's snippets need to be shown. BestMatch.Session maintains a queue and handles extracting of snippets when the browser is free to avoid freezing the main thread. When the snippets are extracted, the placeholder row is replaced with rows of search matches. BestMatch.Session maintains the state of what snippets were already extracted. Drop search result itemPane componenets, on a new search scroll the itemTree to the top to see the most relevant results. |
||
|---|---|---|
| .. | ||
| components | ||
| content | ||
| resource | ||
| tests | ||
| chrome.manifest | ||
| runtests.sh | ||