aboutsummaryrefslogtreecommitdiff
path: root/src/server
diff options
context:
space:
mode:
authorab <abdullah_ahmed@brown.edu>2019-05-04 18:48:01 -0400
committerab <abdullah_ahmed@brown.edu>2019-05-04 18:48:01 -0400
commite19fdbba4cf672aee5bfb59b91b6162431d146d3 (patch)
treea349aee191de59addce5fa3921be0f005bd08c8a /src/server
parentbe5848cb9fe752b3181371f3db8a5269e8945b9b (diff)
queries semi work
Diffstat (limited to 'src/server')
-rw-r--r--src/server/Search.ts25
-rw-r--r--src/server/index.ts3
2 files changed, 28 insertions, 0 deletions
diff --git a/src/server/Search.ts b/src/server/Search.ts
index 9e462f0ae..4911edd1d 100644
--- a/src/server/Search.ts
+++ b/src/server/Search.ts
@@ -5,6 +5,31 @@ import { thisExpression } from 'babel-types';
export class Search {
public static Instance = new Search();
private url = 'http://localhost:8983/solr/';
+ private client: any;
+
+ constructor() {
+ console.log("Search Instantiated!");
+ var SolrNode = require('solr-node');
+ this.client = new SolrNode({
+ host: 'localhost',
+ port: '8983',
+ core: 'dash',
+ protocol: 'http'
+ });
+ var strQuery = this.client.query().q('text:test');
+
+ console.log(strQuery);
+
+ // Search documents using strQuery
+ // client.search(strQuery, (err: any, result: any) => {
+ // if (err) {
+ // console.log(err);
+ // return;
+ // }
+ // console.log('Response:', result.response);
+ // });
+ }
+
public async updateDocument(document: any) {
console.log("UPDATE: ", JSON.stringify(document));
diff --git a/src/server/index.ts b/src/server/index.ts
index f90724152..f2bcd3f00 100644
--- a/src/server/index.ts
+++ b/src/server/index.ts
@@ -122,11 +122,14 @@ app.get("/pull", (req, res) =>
res.redirect("/");
}));
+// SEARCH
+
// GETTERS
app.get("/search", async (req, res) => {
let query = req.query.query || "hello";
let results = await Search.Instance.search(query);
+ console.log(results);
res.send(results);
});