diff options
| author | Andy Rickert <andrew_rickert@brown.edu> | 2020-06-04 23:22:42 -0400 |
|---|---|---|
| committer | Andy Rickert <andrew_rickert@brown.edu> | 2020-06-04 23:22:42 -0400 |
| commit | ce716a382b83f4f05de651a96871877cd772f3af (patch) | |
| tree | 023617b27b1ea71cb42aa3f96678fb07085b3af0 /src/client/views/search/SearchBox.tsx | |
| parent | f36be06355bff894ff1bb19ba6493a77c2732778 (diff) | |
expand bucket
Diffstat (limited to 'src/client/views/search/SearchBox.tsx')
| -rw-r--r-- | src/client/views/search/SearchBox.tsx | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/src/client/views/search/SearchBox.tsx b/src/client/views/search/SearchBox.tsx index c38c4c1b9..525969565 100644 --- a/src/client/views/search/SearchBox.tsx +++ b/src/client/views/search/SearchBox.tsx @@ -80,9 +80,8 @@ const SearchBoxDocument = makeInterface(documentSchema, searchSchema); @observer export class SearchBox extends ViewBoxBaseComponent<FieldViewProps, SearchBoxDocument>(SearchBoxDocument) { - // private get _searchString() { return this.rootDoc.searchQuery; } - // private set _searchString(value) { this.rootDoc.setSearchQuery(value); } - @observable _searchString: string =""; + @computed get _searchString() { return this.layoutDoc.searchQuery; } + @computed set _searchString(value) { this.layoutDoc.searchQuery=(value); } @observable private _resultsOpen: boolean = false; @observable private _searchbarOpen: boolean = false; @observable private _results: [Doc, string[], string[]][] = []; @@ -355,7 +354,12 @@ export class SearchBox extends ViewBoxBaseComponent<FieldViewProps, SearchBoxDoc @action - submitSearch = async () => { + submitSearch = async (reset?:boolean) => { + console.log("yes"); + if (reset){ + this.layoutDoc._searchString=""; + } + console.log(this.layoutDoc._searchString); this.dataDoc[this.fieldKey] = new List<Doc>([]); this.buckets=[]; this.new_buckets={}; @@ -660,10 +664,8 @@ export class SearchBox extends ViewBoxBaseComponent<FieldViewProps, SearchBoxDoc result[0].highlighting=highlights.join(", "); this._visibleDocuments[i] = result[0]; - //<SearchItem {...this.props} doc={result[0]} lines={result[2]} highlighting={highlights} />; result[0].targetDoc=result[0]; - //Doc.AddDocToList(this.buckets![Math.floor(i/3)], this.props.fieldKey, result[0]); this._isSearch[i] = "search"; } } @@ -683,13 +685,9 @@ export class SearchBox extends ViewBoxBaseComponent<FieldViewProps, SearchBoxDoc result[0].query=StrCast(this.layoutDoc._searchString); result[0].lines=new List<string>(result[2]); result[0].highlighting=highlights.join(", "); - - //this._visibleElements[i] = <SearchItem {...this.props} doc={result[0]} lines={result[2]} highlighting={highlights} />; if(i<this._visibleDocuments.length){ this._visibleDocuments[i]=result[0]; result[0].targetDoc=result[0]; - - //Doc.AddDocToList(this.buckets![Math.floor(i/3)], this.props.fieldKey, result[0]); this._isSearch[i] = "search"; } } |
