Commit 277fcac0 authored by Christoph Mayr's avatar Christoph Mayr

all pokemon get sent to solr now

parent e8bdd34a
......@@ -2,7 +2,8 @@
<project version="4">
<component name="ChangeListManager">
<list default="true" id="03703853-d797-498e-a74c-c726d51baed3" name="Default" comment="">
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/search.js" afterPath="$PROJECT_DIR$/search.js" />
<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" />
</list>
<ignored path="$PROJECT_DIR$/.tmp/" />
<ignored path="$PROJECT_DIR$/temp/" />
......@@ -19,8 +20,8 @@
<file leaf-file-name="index.js" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/index.js">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="480">
<caret line="32" column="0" lean-forward="false" selection-start-line="32" selection-start-column="0" selection-end-line="32" selection-end-column="0" />
<state relative-caret-position="-517">
<caret line="22" column="47" lean-forward="false" selection-start-line="22" selection-start-column="47" selection-end-line="22" selection-end-column="47" />
<folding />
</state>
</provider>
......@@ -39,8 +40,8 @@
<file leaf-file-name="pokemoncopy.json" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/pokemoncopy.json">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="1" lean-forward="true" selection-start-line="0" selection-start-column="1" selection-end-line="0" selection-end-column="1" />
<state relative-caret-position="505">
<caret line="79" column="17" lean-forward="true" selection-start-line="79" selection-start-column="17" selection-end-line="79" selection-end-column="17" />
<folding />
</state>
</provider>
......@@ -49,8 +50,8 @@
<file leaf-file-name="pokemon.json" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/pokemon.json">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="1290">
<caret line="86" column="46" lean-forward="false" selection-start-line="86" selection-start-column="40" selection-end-line="86" selection-end-column="46" />
<state relative-caret-position="-903">
<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 />
</state>
</provider>
......@@ -96,10 +97,11 @@
<list>
<option value="$PROJECT_DIR$/package.json" />
<option value="$PROJECT_DIR$/.gitignore" />
<option value="$PROJECT_DIR$/pokemon.json" />
<option value="$PROJECT_DIR$/minijson.json" />
<option value="$PROJECT_DIR$/index.js" />
<option value="$PROJECT_DIR$/search.js" />
<option value="$PROJECT_DIR$/pokemon.json" />
<option value="$PROJECT_DIR$/pokemonjson.js" />
<option value="$PROJECT_DIR$/index.js" />
</list>
</option>
</component>
......@@ -180,12 +182,12 @@
<option name="number" value="Default" />
<option name="presentableId" value="Default" />
<updated>1528804284204</updated>
<workItem from="1528804285428" duration="6744000" />
<workItem from="1528804285428" duration="10549000" />
</task>
<servers />
</component>
<component name="TimeTrackingManager">
<option name="totallyTimeSpent" value="6744000" />
<option name="totallyTimeSpent" value="10549000" />
</component>
<component name="ToolWindowManager">
<frame x="0" y="23" width="1440" height="877" extended-state="0" />
......@@ -237,42 +239,50 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/pokemon.json">
<entry file="file://$PROJECT_DIR$/search.js">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="1290">
<caret line="86" column="46" lean-forward="false" selection-start-line="86" selection-start-column="40" selection-end-line="86" selection-end-column="46" />
<state relative-caret-position="60">
<caret line="4" column="36" lean-forward="false" selection-start-line="4" selection-start-column="36" selection-end-line="4" selection-end-column="36" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/pokemoncopy.json">
<entry file="file://$PROJECT_DIR$/minijson.json">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="1" lean-forward="true" selection-start-line="0" selection-start-column="1" selection-end-line="0" selection-end-column="1" />
<state relative-caret-position="45">
<caret line="3" column="111" lean-forward="false" selection-start-line="3" selection-start-column="111" selection-end-line="3" selection-end-column="111" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/minijson.json">
<entry file="file://$PROJECT_DIR$/pokemonjson.js">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="45">
<caret line="3" column="111" lean-forward="false" selection-start-line="3" selection-start-column="111" selection-end-line="3" selection-end-column="111" />
<state relative-caret-position="245085">
<caret line="16339" column="1" lean-forward="false" selection-start-line="16339" selection-start-column="1" selection-end-line="16339" selection-end-column="1" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/search.js">
<entry file="file://$PROJECT_DIR$/pokemon.json">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="60">
<caret line="4" column="36" lean-forward="false" selection-start-line="4" selection-start-column="36" selection-end-line="4" selection-end-column="36" />
<state relative-caret-position="-903">
<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 />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/pokemoncopy.json">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="505">
<caret line="79" column="17" lean-forward="true" selection-start-line="79" selection-start-column="17" selection-end-line="79" selection-end-column="17" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/index.js">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="480">
<caret line="32" column="0" lean-forward="false" selection-start-line="32" selection-start-column="0" selection-end-line="32" selection-end-column="0" />
<state relative-caret-position="-517">
<caret line="22" column="47" lean-forward="false" selection-start-line="22" selection-start-column="47" selection-end-line="22" selection-end-column="47" />
<folding />
</state>
</provider>
......
......@@ -5,6 +5,28 @@ const request = require('sync-request')
let documents = []
//get contents of json and write relevant information in solr-formatted json
const pokejson = JSON.parse(fs.readFileSync('pokemon.json', 'utf8'));
pokejson.forEach(function(element){
if(element.Number === undefined){
}
else{
const outJson = {}
outJson["poke_id"] = element.Number
outJson["poke_txt_en"] = element.Name
outJson["gen_txt_en"] = element.Generation
outJson["about_txt_en"] = element.About
outJson["types_features"] = element.Types
outJson["maxCP_txt_en"] = element.MaxCP
outJson["maxHP_txt_en"] = element.MaxHP
accumData(outJson)
}
})
/*
// read file through fs readstream
const instream = fs.createReadStream('minijson.json') // simplewiki file has to be named 'simplewiki.json'
const outstream = new stream
......@@ -39,12 +61,14 @@ rl.on('line', function(line) {
})
// send rest of Data when filestream is over
// otherwise the last <10k Objects are not sent
rl.on('close', function() {
sendData(documents)
documents = []
});
*/
// accumulates JSON objects in array until 10k before they are sent
function accumData(postData) {
......
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