Commit c3e460bd authored by Christoph Mayr's avatar Christoph Mayr

Merge branch 'master' of gitlab.mediacube.at:fhs39859/Solr_Pokedex

parents 281219d5 6a676d6e
......@@ -2,7 +2,11 @@
<project version="4">
<component name="ChangeListManager">
<list default="true" id="03703853-d797-498e-a74c-c726d51baed3" name="Default" comment="">
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/script.js" />
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/search.html" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/index.js" afterPath="$PROJECT_DIR$/index.js" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/package-lock.json" afterPath="$PROJECT_DIR$/package-lock.json" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/search.js" afterPath="$PROJECT_DIR$/search.js" />
</list>
<ignored path="$PROJECT_DIR$/.tmp/" />
......@@ -20,8 +24,8 @@
<file leaf-file-name="search.js" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/search.js">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="386">
<caret line="70" column="0" lean-forward="false" selection-start-line="70" selection-start-column="0" selection-end-line="70" selection-end-column="0" />
<state relative-caret-position="640">
<caret line="92" column="5" lean-forward="true" selection-start-line="92" selection-start-column="5" selection-end-line="92" selection-end-column="5" />
<folding />
</state>
</provider>
......@@ -33,14 +37,14 @@
<state relative-caret-position="300">
<caret line="20" column="31" lean-forward="false" selection-start-line="20" selection-start-column="17" selection-end-line="20" selection-end-column="31" />
<folding>
<marker date="1528874370780" expanded="true" signature="338:791" ph="{...}" />
<marker date="1528874370780" expanded="true" signature="376:384" ph="{...}" />
<marker date="1528874370780" expanded="true" signature="393:789" ph="{...}" />
<marker date="1528874370780" expanded="true" signature="871:1389" ph="{...}" />
<marker date="1528874370780" expanded="true" signature="903:1050" ph="{&quot;method&quot;: 'POST'...}" />
<marker date="1528874370780" expanded="true" signature="986:1044" ph="{&quot;Content-Type&quot;: 'application/json'...}" />
<marker date="1528874370780" expanded="true" signature="1280:1316" ph="{...}" />
<marker date="1528874370780" expanded="true" signature="1322:1387" ph="{...}" />
<marker date="1528975230902" expanded="true" signature="338:791" ph="{...}" />
<marker date="1528975230902" expanded="true" signature="376:384" ph="{...}" />
<marker date="1528975230902" expanded="true" signature="393:789" ph="{...}" />
<marker date="1528975230902" expanded="true" signature="871:1388" ph="{...}" />
<marker date="1528975230902" expanded="true" signature="903:1050" ph="{&quot;method&quot;: 'POST'...}" />
<marker date="1528975230902" expanded="true" signature="986:1044" ph="{&quot;Content-Type&quot;: 'application/json'...}" />
<marker date="1528975230902" expanded="true" signature="1279:1315" ph="{...}" />
<marker date="1528975230902" expanded="true" signature="1321:1386" ph="{...}" />
</folding>
</state>
</provider>
......@@ -176,17 +180,18 @@
<option name="presentableId" value="Default" />
<updated>1528804284204</updated>
<workItem from="1528804285428" duration="15571000" />
<workItem from="1528882827788" duration="3610000" />
<workItem from="1528882827788" duration="3908000" />
</task>
<servers />
</component>
<component name="TimeTrackingManager">
<option name="totallyTimeSpent" value="19181000" />
<option name="totallyTimeSpent" value="19479000" />
</component>
<component name="ToolWindowManager">
<frame x="0" y="23" width="1440" height="877" extended-state="0" />
<editor active="true" />
<layout>
<window_info id="Project" active="true" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
<window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="true" content_ui="tabs" />
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
......@@ -256,9 +261,9 @@
<state relative-caret-position="0">
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding>
<marker date="1528975033302" expanded="true" signature="460:4886" ph="{...}" />
<marker date="1528975033302" expanded="true" signature="2816449:2817098" ph="[...]" />
<marker date="1528975033302" expanded="true" signature="2816482:2817064" ph="{...}" />
<marker date="1528975429622" expanded="true" signature="460:4886" ph="{...}" />
<marker date="1528975429622" expanded="true" signature="2816449:2817098" ph="[...]" />
<marker date="1528975429622" expanded="true" signature="2816482:2817064" ph="{...}" />
</folding>
</state>
</provider>
......@@ -284,14 +289,14 @@
<state relative-caret-position="300">
<caret line="20" column="31" lean-forward="false" selection-start-line="20" selection-start-column="17" selection-end-line="20" selection-end-column="31" />
<folding>
<marker date="1528874370780" expanded="true" signature="338:791" ph="{...}" />
<marker date="1528874370780" expanded="true" signature="376:384" ph="{...}" />
<marker date="1528874370780" expanded="true" signature="393:789" ph="{...}" />
<marker date="1528874370780" expanded="true" signature="871:1389" ph="{...}" />
<marker date="1528874370780" expanded="true" signature="903:1050" ph="{&quot;method&quot;: 'POST'...}" />
<marker date="1528874370780" expanded="true" signature="986:1044" ph="{&quot;Content-Type&quot;: 'application/json'...}" />
<marker date="1528874370780" expanded="true" signature="1280:1316" ph="{...}" />
<marker date="1528874370780" expanded="true" signature="1322:1387" ph="{...}" />
<marker date="1528975230902" expanded="true" signature="338:791" ph="{...}" />
<marker date="1528975230902" expanded="true" signature="376:384" ph="{...}" />
<marker date="1528975230902" expanded="true" signature="393:789" ph="{...}" />
<marker date="1528975230902" expanded="true" signature="871:1388" ph="{...}" />
<marker date="1528975230902" expanded="true" signature="903:1050" ph="{&quot;method&quot;: 'POST'...}" />
<marker date="1528975230902" expanded="true" signature="986:1044" ph="{&quot;Content-Type&quot;: 'application/json'...}" />
<marker date="1528975230902" expanded="true" signature="1279:1315" ph="{...}" />
<marker date="1528975230902" expanded="true" signature="1321:1386" ph="{...}" />
</folding>
</state>
</provider>
......@@ -306,8 +311,8 @@
</entry>
<entry file="file://$PROJECT_DIR$/search.js">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="386">
<caret line="70" column="0" lean-forward="false" selection-start-line="70" selection-start-column="0" selection-end-line="70" selection-end-column="0" />
<state relative-caret-position="640">
<caret line="92" column="5" lean-forward="true" selection-start-line="92" selection-start-column="5" selection-end-line="92" selection-end-column="5" />
<folding />
</state>
</provider>
......
......@@ -38,7 +38,7 @@ function sendData(postData){
}
// on response from server, log response
let response = request('POST', 'http://localhost:8983/solr/gettingstarted/update/json/docs?commit=true&overwrite=true', clientServerOptions);
let response = request('POST', 'http://localhost:8983/solr/gettingstarted/update/json/docs?commit=true&overwrite=true', clientServerOptions)
if (response.statusCode !== 200) {
throw(response.body)
} else {
......
......@@ -46,9 +46,9 @@
"dev": true
},
"acorn-node": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/acorn-node/-/acorn-node-1.3.0.tgz",
"integrity": "sha512-efP54n3d1aLfjL2UMdaXa6DsswwzJeI5rqhbFvXMrKiJ6eJFpf+7R0zN7t8IC+XKn2YOAFAv6xbBNgHUkoHWLw==",
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/acorn-node/-/acorn-node-1.4.0.tgz",
"integrity": "sha512-dPW3AldIZRYcQY8/tFrXQqGAFCVQSMLIuNvHyz/qeqLYrqo//DiKkAx6+fbPmz9I89rlTNNV+mhptwbaBGIj/g==",
"dev": true,
"requires": {
"acorn": "5.6.2",
......@@ -657,7 +657,7 @@
"integrity": "sha512-TFHMqfOvxlgrfVzTEkNBSh9SvSNX/HfF4OFI2QFGCyPm02EsyILqnUeb5P6q7JZ3SFNTBL5t2sePRgrN4epUWQ==",
"dev": true,
"requires": {
"acorn-node": "1.3.0",
"acorn-node": "1.4.0",
"defined": "1.0.0",
"minimist": "1.2.0"
}
......@@ -1728,7 +1728,7 @@
"integrity": "sha512-YPPlu67mdnHGTup2A8ff7BC2Pjq0e0Yp/IyTFN03zWO0RcK07uLcbi7C2KpGR2FvWbaB0+bfE27a+sBKebSo7w==",
"dev": true,
"requires": {
"acorn-node": "1.3.0"
"acorn-node": "1.4.0"
}
},
"then-request": {
......
var solr = require('solr-client')
var util = require('util')
const res = 3
const client= solrClient.createClient('localhost',8983,'gettingstarted','/solr')
<!DOCTYPE html>
<html>
<head>
<title>Pokedex</title>
</head>
<body>
</body>
</html>
<script src="index.js">
......@@ -36,6 +36,8 @@ function search(e) {
sendNameQuery(searchValue);
}
// $('searchForm').submit(function(){
//
// console.log(searchValue);
......@@ -46,42 +48,47 @@ function search(e) {
// })
function sendNameQuery(q){
var query = "q=about_txt_en:(" + q +")&rows=100" //rows ist nötig, sonst nur 10 results
console.log(query);
client.search(query,function(err,obj){
if(err){
console.log(err);
}else{
results = obj.response.docs
if (results.length == 0) {
document.getElementById("results").innerHTML = "No results"
}
else{
obj.response.docs.forEach(function(entry){
let item = document.createElement("p")
item.innerHTML =
"<li>Id: <strong>" + entry.id + "</strong></li>" +
"<li>Name: <strong>" + entry.poke_txt_en + "</strong></li>" +
"<li>Gen: " + entry.gen_txt_en + "</li>" +
"<li>MaxHP: " + entry.maxHP_txt_en + "</li>" +
"<li>Types:</li>" +
`<ul id='${entry.id}'></ul>`;
document.getElementById('results').appendChild(item)
entry.types_features.forEach(function(type){
let item3 = document.createElement("li")
item3.innerHTML = type;
document.getElementById(entry.id).appendChild(item3)
})
if(q.length==0){
document.getElementById("results").innerHTML = "Bitte gib' einen Suchbegriff ein!"
}else{
var query = "q=about_txt_en:(" + q +")&rows=100" //rows ist nötig, sonst nur 10 results
console.log(query);
client.search(query,function(err,obj){
if(err){
console.log(err);
}else{
console.log(entry);
})
}
results = obj.response.docs
if (results.length == 0) {
document.getElementById("results").innerHTML = "No results"
}
else{
obj.response.docs.forEach(function(entry){
let item = document.createElement("p")
item.innerHTML =
"<li>Id: <strong>" + entry.id + "</strong></li>" +
"<li>Name: <strong>" + entry.poke_txt_en + "</strong></li>" +
"<li>Gen: " + entry.gen_txt_en + "</li>" +
"<li>MaxHP: " + entry.maxHP_txt_en + "</li>" +
"<li>Types:</li>" +
`<ul id='${entry.id}'></ul>`;
}
});
document.getElementById('results').appendChild(item)
entry.types_features.forEach(function(type){
let item3 = document.createElement("li")
item3.innerHTML = type;
document.getElementById(entry.id).appendChild(item3)
})
console.log(entry);
})
}
}
});
}
}
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