From 15ee40ea8da5140ba5db62185b4a26d36bf6255e Mon Sep 17 00:00:00 2001
From: Andy Rickert <andrew_rickert@brown.edu>
Date: Mon, 27 Apr 2020 15:44:43 -0700
Subject: refactored searchbox doctype out from querybox class to help with
 displaying search results as different collection types

---
 src/client/views/nodes/DocumentContentsView.tsx | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

(limited to 'src/client/views/nodes/DocumentContentsView.tsx')

diff --git a/src/client/views/nodes/DocumentContentsView.tsx b/src/client/views/nodes/DocumentContentsView.tsx
index 7522af3a3..083638198 100644
--- a/src/client/views/nodes/DocumentContentsView.tsx
+++ b/src/client/views/nodes/DocumentContentsView.tsx
@@ -24,7 +24,7 @@ import { ImageBox } from "./ImageBox";
 import { KeyValueBox } from "./KeyValueBox";
 import { PDFBox } from "./PDFBox";
 import { PresBox } from "./PresBox";
-import { QueryBox } from "./QueryBox";
+import { SearchBox } from "../search/SearchBox";
 import { ColorBox } from "./ColorBox";
 import { DashWebRTCVideo } from "../webcam/DashWebRTCVideo";
 import { LinkAnchorBox } from "./LinkAnchorBox";
@@ -111,7 +111,7 @@ export class DocumentContentsView extends React.Component<DocumentViewProps & {
                     components={{
                         FormattedTextBox, ImageBox, DirectoryImportBox, FontIconBox, LabelBox, SliderBox, FieldView,
                         CollectionFreeFormView, CollectionDockingView, CollectionSchemaView, CollectionView, WebBox, KeyValueBox,
-                        PDFBox, VideoBox, AudioBox, PresBox, YoutubeBox, PresElementBox, QueryBox,
+                        PDFBox, VideoBox, AudioBox, PresBox, YoutubeBox, PresElementBox, SearchBox,
                         ColorBox, DashWebRTCVideo, LinkAnchorBox, InkingStroke, DocHolderBox, LinkBox, ScriptingBox,
                         RecommendationsBox, ScreenshotBox
                     }}
-- 
cgit v1.2.3-70-g09d2


From 9aab1f5e7dc7438dfa8a93afe03bd5746315c994 Mon Sep 17 00:00:00 2001
From: Andy Rickert <andrew_rickert@brown.edu>
Date: Wed, 29 Apr 2020 13:49:55 -0700
Subject: bugfixing

---
 src/client/documents/Documents.ts               |  2 +-
 src/client/views/nodes/DocumentContentsView.tsx |  3 ++-
 src/client/views/search/SearchBox.tsx           | 31 +++++++++++++++++--------
 3 files changed, 24 insertions(+), 12 deletions(-)

(limited to 'src/client/views/nodes/DocumentContentsView.tsx')

diff --git a/src/client/documents/Documents.ts b/src/client/documents/Documents.ts
index e5b3c8a97..d440ed287 100644
--- a/src/client/documents/Documents.ts
+++ b/src/client/documents/Documents.ts
@@ -539,7 +539,7 @@ export namespace Docs {
         }
 
         export function SearchDocument(options: DocumentOptions = {}) {
-            return InstanceFromProto(Prototypes.get(DocumentType.SEARCH), "", options);
+            return InstanceFromProto(Prototypes.get(DocumentType.SEARCH), new List<Doc>([]), options);
         }
 
         export function ColorDocument(options: DocumentOptions = {}) {
diff --git a/src/client/views/nodes/DocumentContentsView.tsx b/src/client/views/nodes/DocumentContentsView.tsx
index 083638198..cb9e9f5ba 100644
--- a/src/client/views/nodes/DocumentContentsView.tsx
+++ b/src/client/views/nodes/DocumentContentsView.tsx
@@ -25,6 +25,7 @@ import { KeyValueBox } from "./KeyValueBox";
 import { PDFBox } from "./PDFBox";
 import { PresBox } from "./PresBox";
 import { SearchBox } from "../search/SearchBox";
+import { SearchItem } from "../search/SearchItem"
 import { ColorBox } from "./ColorBox";
 import { DashWebRTCVideo } from "../webcam/DashWebRTCVideo";
 import { LinkAnchorBox } from "./LinkAnchorBox";
@@ -111,7 +112,7 @@ export class DocumentContentsView extends React.Component<DocumentViewProps & {
                     components={{
                         FormattedTextBox, ImageBox, DirectoryImportBox, FontIconBox, LabelBox, SliderBox, FieldView,
                         CollectionFreeFormView, CollectionDockingView, CollectionSchemaView, CollectionView, WebBox, KeyValueBox,
-                        PDFBox, VideoBox, AudioBox, PresBox, YoutubeBox, PresElementBox, SearchBox,
+                        PDFBox, VideoBox, AudioBox, PresBox, YoutubeBox, PresElementBox, SearchBox, SearchItem,
                         ColorBox, DashWebRTCVideo, LinkAnchorBox, InkingStroke, DocHolderBox, LinkBox, ScriptingBox,
                         RecommendationsBox, ScreenshotBox
                     }}
diff --git a/src/client/views/search/SearchBox.tsx b/src/client/views/search/SearchBox.tsx
index 5ef71ca41..a22052f2e 100644
--- a/src/client/views/search/SearchBox.tsx
+++ b/src/client/views/search/SearchBox.tsx
@@ -348,6 +348,7 @@ export class SearchBox extends ViewBoxBaseComponent<FieldViewProps, SearchBoxDoc
 
     @action
     submitSearch = async () => {
+        this.dataDoc[this.fieldKey] = new List<Doc>([]);
         const query = this._searchString;
         this.getFinalQuery(query);
         this._results = [];
@@ -555,10 +556,15 @@ export class SearchBox extends ViewBoxBaseComponent<FieldViewProps, SearchBoxDoc
                         if (result) {
                             const highlights = Array.from([...Array.from(new Set(result[1]).values())]);
                             result[0].query=this._searchString;
-                            this._visibleElements[i] = <SearchItem {...this.props} doc={result[0]} lines={result[2]} highlighting={highlights} />;
-                            Doc.AddDocToList(this.props.Document, undefined, result[0])
+                            //Make alias
+                            result[0].lines=new List<string>(result[2]);
+                            result[0].highlighting=new List<string>(highlights);
 
-                            this._visibleDocuments[i]= result[0];
+                            this._visibleElements[i] = <SearchItem {...this.props} doc={result[0]} lines={result[2]} highlighting={highlights} />;
+                            debugger;
+                            Doc.AddDocToList(this.dataDoc, this.props.fieldKey, result[0])
+                            //this.fieldkey + dash search results
+                            //ask about document parmater in collection view
                             this._isSearch[i] = "search";
                         }
                     }
@@ -567,9 +573,13 @@ export class SearchBox extends ViewBoxBaseComponent<FieldViewProps, SearchBoxDoc
                         if (result) {
                             const highlights = Array.from([...Array.from(new Set(result[1]).values())]);
                             result[0].query=this._searchString;
+                            result[0].lines=new List<string>(result[2]);
+                            result[0].highlighting=new List<string>(highlights);
+
                             this._visibleElements[i] = <SearchItem {...this.props} doc={result[0]} lines={result[2]} highlighting={highlights} />;
-                            this._visibleDocuments[i] = result[0];
-                            Doc.AddDocToList(this.props.Document, undefined, result[0])
+                            debugger;
+
+                            Doc.AddDocToList(this.dataDoc, this.props.fieldKey, result[0])
                             this._isSearch[i] = "search";
                         }
                     }
@@ -632,6 +642,8 @@ export class SearchBox extends ViewBoxBaseComponent<FieldViewProps, SearchBoxDoc
         }
     }
 
+   //layoutDoc 
+
     @computed
     get menuHeight() {
         return document.getElementById("hi")?.clientHeight;
@@ -717,7 +729,7 @@ export class SearchBox extends ViewBoxBaseComponent<FieldViewProps, SearchBoxDoc
     
     @computed get docButtons() {
         const nodeBtns = this.props.Document.nodeButtons;
-        let width = () => NumCast(this.props.Document.width);
+        let width = () => NumCast(this.props.Document._width);
         if (this.rootDoc.sideBar===true){
             width = MainView.Instance.flyoutWidthFunc;
         }
@@ -755,7 +767,7 @@ export class SearchBox extends ViewBoxBaseComponent<FieldViewProps, SearchBoxDoc
 
     @computed get keyButtons() {
         const nodeBtns = this.props.Document.keyButtons;
-        let width = () => NumCast(this.props.Document.width);
+        let width = () => NumCast(this.props.Document._width);
         if (this.rootDoc.sideBar===true){
             width = MainView.Instance.flyoutWidthFunc;
         }
@@ -793,7 +805,7 @@ export class SearchBox extends ViewBoxBaseComponent<FieldViewProps, SearchBoxDoc
 
     @computed get defaultButtons() {
         const defBtns = this.props.Document.defaultButtons;
-        let width = () => NumCast(this.props.Document.width);
+        let width = () => NumCast(this.props.Document._width);
         if (this.rootDoc.sideBar===true){
             width = MainView.Instance.flyoutWidthFunc;
         }
@@ -909,7 +921,7 @@ export class SearchBox extends ViewBoxBaseComponent<FieldViewProps, SearchBoxDoc
         newPinDoc.presentationTargetDoc = doc;
         return Doc.AddDocToList(this.dataDoc, this.fieldKey, newPinDoc);
     }
-
+    //Make id layour document
     render() {
 
         return (
@@ -943,7 +955,6 @@ export class SearchBox extends ViewBoxBaseComponent<FieldViewProps, SearchBoxDoc
                     </div>
                 </div>
                 <CollectionView {...this.props}
-                        children={this._visibleDocuments}
                         Document={this.props.Document}
                         PanelHeight={this.panelHeight}
                         moveDocument={returnFalse}
-- 
cgit v1.2.3-70-g09d2

