From c5e7890b5055521bf030eff8db99ff189b3f9eb2 Mon Sep 17 00:00:00 2001 From: Andy Rickert Date: Sun, 16 Aug 2020 21:56:31 -0400 Subject: close filter button, bugfixes --- src/client/views/search/SearchBox.tsx | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/client/views/search') diff --git a/src/client/views/search/SearchBox.tsx b/src/client/views/search/SearchBox.tsx index 99db78778..c9c6aa631 100644 --- a/src/client/views/search/SearchBox.tsx +++ b/src/client/views/search/SearchBox.tsx @@ -466,6 +466,7 @@ export class SearchBox extends ViewBoxBaseComponent { + Doc.BrushDoc(result[0]); + }); e.stopPropagation(); this._openNoResults = false; this._resultsOpen = true; @@ -720,6 +724,10 @@ export class SearchBox extends ViewBoxBaseComponent { + this._results.forEach(result => { + Doc.UnBrushDoc(result[0]); + result[0].searchMatch = undefined; + }); //this.closeResults(); this._searchbarOpen = false; } -- cgit v1.2.3-70-g09d2 From c6fabd1ae9d85dc0e9b2cf86d3bbd3c0a8a4c25b Mon Sep 17 00:00:00 2001 From: bobzel Date: Wed, 19 Aug 2020 13:28:30 -0400 Subject: fixed searchBox to be more efficient by avoiding react renders --- src/client/views/search/SearchBox.tsx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/client/views/search') diff --git a/src/client/views/search/SearchBox.tsx b/src/client/views/search/SearchBox.tsx index 10a45b34a..7a4e75f21 100644 --- a/src/client/views/search/SearchBox.tsx +++ b/src/client/views/search/SearchBox.tsx @@ -11,7 +11,7 @@ import { List } from '../../../fields/List'; import { createSchema, listSpec, makeInterface } from '../../../fields/Schema'; import { SchemaHeaderField } from '../../../fields/SchemaHeaderField'; import { Cast, NumCast, StrCast } from '../../../fields/Types'; -import { returnFalse, Utils } from '../../../Utils'; +import { returnFalse, Utils, returnZero } from '../../../Utils'; import { Docs } from '../../documents/Documents'; import { DocumentType } from "../../documents/DocumentTypes"; import { CurrentUserUtils } from '../../util/CurrentUserUtils'; @@ -967,7 +967,7 @@ export class SearchBox extends ViewBoxBaseComponent
@@ -1053,13 +1053,13 @@ export class SearchBox extends ViewBoxBaseComponent {this._searchbarOpen === true ?
- {this.noresults === "" ?
+ {this.noresults === "" ?
height : () => 0} - PanelWidth={this.open === true ? () => length : () => 0} + PanelHeight={this.open ? () => height : returnZero} + PanelWidth={this.open ? () => length : returnZero} overflow={length > window.innerWidth || rows > 6 ? true : false} focus={this.selectElement} ScreenToLocalTransform={Transform.Identity} -- cgit v1.2.3-70-g09d2 From c04c831133072aed911c131eba799561ec911664 Mon Sep 17 00:00:00 2001 From: bobzel Date: Wed, 19 Aug 2020 13:34:50 -0400 Subject: from last --- src/client/views/search/SearchBox.tsx | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) (limited to 'src/client/views/search') diff --git a/src/client/views/search/SearchBox.tsx b/src/client/views/search/SearchBox.tsx index 7a4e75f21..eafe58cbe 100644 --- a/src/client/views/search/SearchBox.tsx +++ b/src/client/views/search/SearchBox.tsx @@ -877,15 +877,15 @@ export class SearchBox extends ViewBoxBaseComponent([]); this.resultsScrolled(); } + returnHeight = () => 31 + 31 * 6; + returnLength = () => { + const cols = Cast(this.props.Document._schemaHeaders, listSpec(SchemaHeaderField), []).length; + return cols * 205 + 51; + } render() { this.props.Document._chromeStatus === "disabled"; this.props.Document._searchDoc = true; - const cols = Cast(this.props.Document._schemaHeaders, listSpec(SchemaHeaderField), []).length; - let length = 0; - length = cols * 205 + 51; - let height = 0; const rows = this.children; - height = 31 + 31 * 6; return (
{Doc.CurrentUserEmail}
@@ -923,9 +923,7 @@ export class SearchBox extends ViewBoxBaseComponent(this.docsforfilter); const newdocs = DocListCast(d.data); - newdocs.forEach((newdoc) => { - newarray.push(newdoc); - }); + newdocs.forEach(newdoc => newarray.push(newdoc)); } }); docs = newarray; @@ -945,9 +943,7 @@ export class SearchBox extends ViewBoxBaseComponent(); d._docFilters = new List(); const newdocs = DocListCast(d.data); - newdocs.forEach((newdoc) => { - newarray.push(newdoc); - }); + newdocs.forEach(newdoc => newarray.push(newdoc)); } }); docs = newarray; @@ -1058,8 +1054,8 @@ export class SearchBox extends ViewBoxBaseComponent height : returnZero} - PanelWidth={this.open ? () => length : returnZero} + PanelHeight={this.open ? this.returnHeight : returnZero} + PanelWidth={this.open ? this.returnLength : returnZero} overflow={length > window.innerWidth || rows > 6 ? true : false} focus={this.selectElement} ScreenToLocalTransform={Transform.Identity} -- cgit v1.2.3-70-g09d2 From 927eb9ba0598018cffad7c102ee551eb3867e195 Mon Sep 17 00:00:00 2001 From: bobzel Date: Wed, 19 Aug 2020 13:35:40 -0400 Subject: from last --- src/client/views/search/SearchBox.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/client/views/search') diff --git a/src/client/views/search/SearchBox.tsx b/src/client/views/search/SearchBox.tsx index eafe58cbe..ed6eb00d8 100644 --- a/src/client/views/search/SearchBox.tsx +++ b/src/client/views/search/SearchBox.tsx @@ -624,7 +624,7 @@ export class SearchBox extends ViewBoxBaseComponent, header: SchemaHeaderField) => p || (header.desc !== undefined && suffixMap(header.type) ? (header.heading + suffixMap(header.type) + (header.desc ? " desc" : " asc")) : undefined), undefined); } - private NumResults = 50; + private NumResults = 500; private lockPromise?: Promise; getResults = async (query: string) => { if (this.lockPromise) { -- cgit v1.2.3-70-g09d2 From f76da71ce7d0370d2a8bd91069b346414925f72c Mon Sep 17 00:00:00 2001 From: bobzel Date: Wed, 19 Aug 2020 13:38:26 -0400 Subject: turned off sorting on server for now. --- src/client/views/search/SearchBox.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/client/views/search') diff --git a/src/client/views/search/SearchBox.tsx b/src/client/views/search/SearchBox.tsx index ed6eb00d8..bdf5e7e44 100644 --- a/src/client/views/search/SearchBox.tsx +++ b/src/client/views/search/SearchBox.tsx @@ -632,7 +632,7 @@ export class SearchBox extends ViewBoxBaseComponent { while (this._results.length <= this._endIndex && (this._numTotalResults === -1 || this._maxSearchIndex < this._numTotalResults)) { - this._curRequest = SearchUtil.Search(query, true, { onlyAliases: true, allowAliases: true, sort: this.primarySort, fq: this.filterQuery, start: 0, rows: this.NumResults, hl: true, "hl.fl": "*", }).then(action(async (res: SearchUtil.DocSearchResult) => { + this._curRequest = SearchUtil.Search(query, true, { onlyAliases: true, allowAliases: true, /*sort: this.primarySort,*/ fq: this.filterQuery, start: 0, rows: this.NumResults, hl: true, "hl.fl": "*", }).then(action(async (res: SearchUtil.DocSearchResult) => { // happens at the beginning this.realTotalResults = res.numFound <= 0 ? 0 : res.numFound; if (res.numFound !== this._numTotalResults && this._numTotalResults === -1) { -- cgit v1.2.3-70-g09d2 From f962986693267e30ca18884e6f04e402181a5a1a Mon Sep 17 00:00:00 2001 From: bobzel Date: Wed, 19 Aug 2020 13:58:31 -0400 Subject: starting refactor of searchBox code --- src/client/views/search/SearchBox.tsx | 94 ++++++++++++----------------------- 1 file changed, 33 insertions(+), 61 deletions(-) (limited to 'src/client/views/search') diff --git a/src/client/views/search/SearchBox.tsx b/src/client/views/search/SearchBox.tsx index bdf5e7e44..df64c38d0 100644 --- a/src/client/views/search/SearchBox.tsx +++ b/src/client/views/search/SearchBox.tsx @@ -882,6 +882,35 @@ export class SearchBox extends ViewBoxBaseComponent { + scope && (this.filter = false); + this.searchFullDB = scope; + this.dataDoc[this.fieldKey] = new List([]); + if (this.currentSelectedCollection !== undefined) { + let newarray: Doc[] = []; + let docs: Doc[] = []; + docs = DocListCast(this.currentSelectedCollection.dataDoc[Doc.LayoutFieldKey(this.currentSelectedCollection.dataDoc)]); + while (docs.length > 0) { + newarray = []; + docs.forEach((d) => { + if (d.data !== undefined) { + d._searchDocs = new List(); + d._docFilters = new List(); + const newdocs = DocListCast(d.data); + newdocs.forEach((newdoc) => { + newarray.push(newdoc); + }); + } + }); + docs = newarray; + } + this.currentSelectedCollection.props.Document._docFilters = new List(); + this.currentSelectedCollection.props.Document._searchDocs = undefined; + this.currentSelectedCollection = undefined; + } + this.submitSearch(); + } render() { this.props.Document._chromeStatus === "disabled"; this.props.Document._searchDoc = true; @@ -969,70 +998,13 @@ export class SearchBox extends ViewBoxBaseComponent
+ this.changeSearchScope("")} /> + Collection +