aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/search/SearchBox.tsx
diff options
context:
space:
mode:
authorMonika <monika_hedman@brown.edu>2019-06-20 12:56:46 -0400
committerMonika <monika_hedman@brown.edu>2019-06-20 12:56:46 -0400
commit3e6f1e6e2388bcab53c4ee7d680fa6504e82f74d (patch)
treeb1ca406ef091ded1b589af2d4656f72130e84037 /src/client/views/search/SearchBox.tsx
parentc74396c0dcc5df9636481635beca64b5de71dde1 (diff)
collections almost theree
Diffstat (limited to 'src/client/views/search/SearchBox.tsx')
-rw-r--r--src/client/views/search/SearchBox.tsx31
1 files changed, 10 insertions, 21 deletions
diff --git a/src/client/views/search/SearchBox.tsx b/src/client/views/search/SearchBox.tsx
index 546d58356..4ebd9c5e4 100644
--- a/src/client/views/search/SearchBox.tsx
+++ b/src/client/views/search/SearchBox.tsx
@@ -2,7 +2,7 @@ import * as React from 'react';
import { observer } from 'mobx-react';
import { observable, action, runInAction } from 'mobx';
import "./SearchBox.scss";
-import { faSearch, faFilePdf, faFilm, faImage, faObjectGroup, faStickyNote, faMusic, faLink, faChartBar, faGlobeAsia, faBan, faThList } from '@fortawesome/free-solid-svg-icons';
+import { faSearch, faFilePdf, faFilm, faImage, faObjectGroup, faStickyNote, faMusic, faLink, faChartBar, faGlobeAsia, faBan, faThList, faWineGlassAlt } from '@fortawesome/free-solid-svg-icons';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { library } from '@fortawesome/fontawesome-svg-core';
import * as rp from 'request-promise';
@@ -216,30 +216,19 @@ export class SearchBox extends React.Component {
addCollectionFilter(query: string): string {
let collections: Doc[] = this.getCurCollections();
- console.log("collections", collections)
- let finalQuery: string = "";
let oldWords = query.split(" ");
- let newWords: string[] = [];
- oldWords.forEach(word => {
- collections.forEach(doc => {
- let proto = doc.proto;
- let protoId = (proto || doc)[Id];
- // console.log(StrCast(doc.title), protoId);
- let colString: string = "+{!join from=data_l to=id}id:" + protoId + " ";
- //{!join from=data_l to=id}id:{collectionProtoId}
- let newWrd: string = colString + word;
- // console.log(newWrd);
- newWords.push(newWrd);
- });
+ let collectionString: string[] = [];
+ collections.forEach(doc => {
+ let proto = doc.proto;
+ let protoId = (proto || doc)[Id];
+ let colString: string = "{!join from=data_l to=id}id:" + protoId + " ";
+ collectionString.push(colString);
});
- console.log(newWords)
-
- query = newWords.join(" ");
-
- return query;
- // const protoId = (proto || doc)[Id];
+ let finalColString = collectionString.join(" ");
+ finalColString = finalColString.trim();
+ return "+(" + finalColString + ")" + query;
}
@action