MCPcopy
hub / github.com/agent0ai/agent-zero / runSearch

Function runSearch

plugins/_editor/webui/editor-store.js:735–758  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

733 },
734
735 runSearch() {
736 const query = String(this.searchQuery || "");
737 if (!query) {
738 this.searchMatches = [];
739 this.searchIndex = -1;
740 this.schedulePreviewEnhance();
741 return;
742 }
743 const lower = query.toLowerCase();
744 const matches = [];
745 for (const page of this.pages()) {
746 const text = this.renderedTextForPage(page);
747 let index = 0;
748 let occurrence = 0;
749 while ((index = text.toLowerCase().indexOf(lower, index)) >= 0) {
750 matches.push({ pageIndex: page.index, occurrence, offset: index });
751 occurrence += 1;
752 index += Math.max(1, lower.length);
753 }
754 }
755 this.searchMatches = matches;
756 this.searchIndex = matches.length ? 0 : -1;
757 this.goToCurrentSearchMatch();
758 },
759
760 nextSearchMatch() {
761 if (!this.searchMatches.length) return;

Callers

nothing calls this directly

Calls 3

pagesMethod · 0.80
indexOfMethod · 0.80
pushMethod · 0.45

Tested by

no test coverage detected