aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/search/SearchBox.tsx
diff options
context:
space:
mode:
authorMonika <monika_hedman@brown.edu>2019-06-24 16:07:38 -0400
committerMonika <monika_hedman@brown.edu>2019-06-24 16:07:38 -0400
commit56394d6631f494526546cb5cd03297b400a85e65 (patch)
tree406506e35e9c8bb4c4a5b838ad82e5ed154894e9 /src/client/views/search/SearchBox.tsx
parentcfb2e001ab6df21558fb5d7f9c18e47c7b6c21bb (diff)
clean ups
Diffstat (limited to 'src/client/views/search/SearchBox.tsx')
-rw-r--r--src/client/views/search/SearchBox.tsx17
1 files changed, 1 insertions, 16 deletions
diff --git a/src/client/views/search/SearchBox.tsx b/src/client/views/search/SearchBox.tsx
index 30bd0c3d9..28bcadc6b 100644
--- a/src/client/views/search/SearchBox.tsx
+++ b/src/client/views/search/SearchBox.tsx
@@ -194,23 +194,17 @@ export class SearchBox extends React.Component {
get fieldFiltersApplied() { return !(this.dataFieldStatus && this.authorFieldStatus && this.titleFieldStatus); }
+ //TODO: basically all of this
//gets all of the collections of all the docviews that are selected
//if a collection is the only thing selected, search only in that collection (not its container)
getCurCollections(): Doc[] {
let selectedDocs: DocumentView[] = SelectionManager.SelectedDocuments();
let collections: Doc[] = [];
- //TODO: make this some sort of error
- if (selectedDocs.length === 0) {
- console.log("there is nothing selected!")
- }
- //also searches in a collection if it is selected
- else {
selectedDocs.forEach(async element => {
let layout: string = StrCast(element.props.Document.baseLayout);
//checks if selected view (element) is a collection. if it is, adds to list to search through
if (layout.indexOf("Collection") > -1) {
- console.log("current doc is a collection")
//makes sure collections aren't added more than once
if (!collections.includes(element.props.Document)) {
collections.push(element.props.Document);
@@ -223,7 +217,6 @@ export class SearchBox extends React.Component {
collections.push(containingView.props.Document);
}
});
- }
return collections;
}
@@ -249,7 +242,6 @@ export class SearchBox extends React.Component {
query = this.addCollectionFilter(query);
query = query.replace(/\s+/g, ' ').trim();
}
- console.log(query)
return query;
}
@@ -276,7 +268,6 @@ export class SearchBox extends React.Component {
let results: Doc[];
query = this.getFinalQuery(query);
- console.log(query)
//if there is no query there should be no result
if (query === "") {
@@ -287,8 +278,6 @@ export class SearchBox extends React.Component {
results = await this.getResults(query);
}
- console.log(results);
-
runInAction(() => {
this._resultsOpen = true;
this._results = results;
@@ -312,18 +301,14 @@ export class SearchBox extends React.Component {
docs.push(field);
}
}
- console.log(docs)
return this.filterDocsByType(docs);
}
//this.icons will now include all the icons that need to be included
@action filterDocsByType(docs: Doc[]) {
- console.log(this._icons)
let finalDocs: Doc[] = [];
docs.forEach(doc => {
- console.log(doc.layout)
let layoutresult = Cast(doc.type, "string", "");
- console.log(layoutresult)
if (this._icons.includes(layoutresult)) {
finalDocs.push(doc);
}