Commit 5cd01f67 authored by Christoph Mayr's avatar Christoph Mayr

added first try to implement a search frontend interface

parent fe78d8fc
......@@ -10,3 +10,4 @@ node_modules/
# build
dist/
bundle.js
\ No newline at end of file
This diff is collapsed.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Poke Dex Go</title>
</head>
<body>
<section class="search">
<form action="">
<input id="input" autocomplete="off" /><button>Send</button>
</form>
</section>
<section class="results">
</section>
<script src="bundle.js"></script>
</body>
</html>
\ No newline at end of file
This diff is collapsed.
......@@ -5,12 +5,15 @@
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "node index.js"
"start": "node index.js",
"search": "node search.js",
"build": "browserify search.js > bundle.js"
},
"author": "Christoph",
"license": "MIT",
"dependencies": {
"fs": "0.0.1-security",
"jquery": "^3.3.1",
"pokeapi": "0.0.1",
"pokeapi-js-wrapper": "^1.1.1",
"readline": "^1.3.0",
......@@ -18,5 +21,8 @@
"stream": "0.0.2",
"sync-request": "^6.0.0",
"util": "^0.11.0"
},
"devDependencies": {
"browserify": "^16.2.2"
}
}
var solr = require('solr-client');
const solr = require('solr-client');
const $ = require('jquery');
const client = solr.createClient('localhost', 8983, 'gettingstarted', '/solr');
const client = solr.createClient('127.0.0.1', '8983', 'gettingstarted', '/solr');
const startquery = `q=types_features:sunlight`;
$('form').submit(function(){
sendQuery($('#input').val())
return false
})
function sendQuery(q){
var query = "q=poke_txt_en:" + q
const request = client.search(query, function (error, result) {
console.log(error);
console.log(result);
})
}
const startquery = `q=name_txt_en:Bulbasaur`;
const request = client.search(startquery, function (error, result) {
console.log(result.response.docs);
console.log(result);
})
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment