Commit ad37c430 authored by Christoph Mayr's avatar Christoph Mayr
parents cad10c36 30289c90
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ChangeListManager">
<list default="true" id="03703853-d797-498e-a74c-c726d51baed3" name="Default" comment="" />
<list default="true" id="03703853-d797-498e-a74c-c726d51baed3" name="Default" comment="">
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/index.html" afterPath="$PROJECT_DIR$/index.html" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/search.js" afterPath="$PROJECT_DIR$/search.js" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/style.css" afterPath="$PROJECT_DIR$/style.css" />
</list>
<ignored path="$PROJECT_DIR$/.tmp/" />
<ignored path="$PROJECT_DIR$/temp/" />
<ignored path="$PROJECT_DIR$/tmp/" />
......@@ -17,9 +22,11 @@
<file leaf-file-name="search.js" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/search.js">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="395">
<caret line="88" column="49" lean-forward="false" selection-start-line="88" selection-start-column="49" selection-end-line="88" selection-end-column="49" />
<folding />
<state relative-caret-position="410">
<caret line="89" column="49" lean-forward="false" selection-start-line="89" selection-start-column="49" selection-end-line="89" selection-end-column="49" />
<folding>
<marker date="1529015757325" expanded="true" signature="866:997" ph="{...}" />
</folding>
</state>
</provider>
</entry>
......@@ -50,7 +57,9 @@
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-7">
<caret line="16" column="38" lean-forward="true" selection-start-line="16" selection-start-column="38" selection-end-line="16" selection-end-column="38" />
<folding />
<folding>
<marker date="1529015757328" expanded="true" signature="1792:1803" ph="..." />
</folding>
</state>
</provider>
</entry>
......@@ -58,8 +67,8 @@
<file leaf-file-name="style.css" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/style.css">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="713">
<caret line="87" column="26" lean-forward="false" selection-start-line="87" selection-start-column="26" selection-end-line="87" selection-end-column="26" />
<state relative-caret-position="825">
<caret line="55" column="20" lean-forward="false" selection-start-line="55" selection-start-column="20" selection-end-line="55" selection-end-column="20" />
<folding />
</state>
</provider>
......@@ -218,12 +227,12 @@
<option name="presentableId" value="Default" />
<updated>1528804284204</updated>
<workItem from="1528804285428" duration="15571000" />
<workItem from="1528882827788" duration="11792000" />
<workItem from="1528882827788" duration="11875000" />
</task>
<servers />
</component>
<component name="TimeTrackingManager">
<option name="totallyTimeSpent" value="27363000" />
<option name="totallyTimeSpent" value="27446000" />
</component>
<component name="ToolWindowManager">
<frame x="0" y="23" width="1440" height="877" extended-state="0" />
......@@ -349,22 +358,26 @@
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-7">
<caret line="16" column="38" lean-forward="true" selection-start-line="16" selection-start-column="38" selection-end-line="16" selection-end-column="38" />
<folding />
<folding>
<marker date="1529015757328" expanded="true" signature="1792:1803" ph="..." />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/search.js">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="395">
<caret line="88" column="49" lean-forward="false" selection-start-line="88" selection-start-column="49" selection-end-line="88" selection-end-column="49" />
<folding />
<state relative-caret-position="410">
<caret line="89" column="49" lean-forward="false" selection-start-line="89" selection-start-column="49" selection-end-line="89" selection-end-column="49" />
<folding>
<marker date="1529015757325" expanded="true" signature="866:997" ph="{...}" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/style.css">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="713">
<caret line="87" column="26" lean-forward="false" selection-start-line="87" selection-start-column="26" selection-end-line="87" selection-end-column="26" />
<state relative-caret-position="825">
<caret line="55" column="20" lean-forward="false" selection-start-line="55" selection-start-column="20" selection-end-line="55" selection-end-column="20" />
<folding />
</state>
</provider>
......
......@@ -17,7 +17,7 @@
<h2>Search for a Pokémon!</h2>
<input id="input" name="q" type="text" class="formelement"/>
<section id="suggestions"></section>
<select name="type" id="type" class="formelement">
<option value="">-Pick a Type to Filter-</option>
<option value="Water">Water</option>
......@@ -50,10 +50,6 @@
</section>
</section>
<script src="bundle.js"></script>
......
......@@ -38,11 +38,13 @@ function search(e) {
const searchValue = document.getElementById('input').value
console.log(searchValue);
clearList();
sendSpellcheck(searchValue);
sendNameQuery(searchValue);
}
function clearList() {
document.getElementById("results").innerHTML = ""
document.getElementById("suggestions").innerHTML = ""
}
// $('searchForm').submit(function(){
......@@ -64,13 +66,12 @@ function sendNameQuery(q){
.q(q)
.dismax()
.qf({poke_txt_en : 0.2 , about_txt_en : 3.3})
.mm(0)
.start(0)
.rows(10)
if(filter)
query.matchFilter('types_features_str', filter)
console.log(query);
// console.log(query);
client.search(query,function(err,obj){
if(err){
console.log(err);
......@@ -102,11 +103,41 @@ function sendNameQuery(q){
})
console.log(entry);
// console.log(entry);
})
}
}
});
}
}
function sendSpellcheck(spell){
var spell = client.createQuery()
.dismax()
.qf({poke_txt_en : 0.2 , about_txt_en : 3.3})
.start(0)
.rows(10)
.set(`spellcheck=on`)
.set(`spellcheck.q=`+spell)
// if(filter)
// query.matchFilter('types_features_str', filter)
client.spell(spell,function(err,obj){
if(err){
console.log(err);
}else{
suggest = obj.spellcheck.collations
// console.log(suggest[1].collationQuery)
// console.log(suggest.length)
for (var i = 1; i < suggest.length; i++) {
let test= suggest[i].collationQuery
console.log(test)
let word = document.createElement("li")
i++;
word.innerHTML = test;
document.getElementById("suggestions").appendChild(word)
// if ((i+1)<suggest.length) words +=", "
}
}});
}
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