Commit ac2ff717 authored by Selina Nicole Brunner's avatar Selina Nicole Brunner

add type filter

parent f1fadd5d
......@@ -10,6 +10,30 @@
<form class="searchForm" action="">
<input id="input" name="q" type="text" />
<label><p>Filter by type:</p>
<select name="type" id="type">
<option value="">-Zum filtern auswählen-</option>
<option value="Water">Water</option>
<option value="Fire">Fire</option>
<option value="Grass">Grass</option>
<option value="Poison">Poison</option>
<option value="Normal">Normal</option>
<option value="Electric">Electric</option>
<option value="Ice">Ice</option>
<option value="Fighting">Fighting</option>
<option value="Ground">Ground</option>
<option value="Flying">Flying</option>
<option value="Psychic">Psychic</option>
<option value="Bug">Bug</option>
<option value="Rock">Rock</option>
<option value="Ghost">Ghost</option>
<option value="Dragon">Dragon</option>
<option value="Dark">Dark</option>
<option value="Steel">Steel</option>
<option value="Fairy">Fairy</option>
</select>
</label>
<button id="searchButton" type="submit" class="button">Send</button>
</form>
</section>
......
const solr = require('solr-client');
// const $ = require('jquery');
const $ = require('jquery');
const client = solr.createClient('127.0.0.1', '8983', 'gettingstarted', '/solr');
// const startQuery = `q=id:3`;
......@@ -25,6 +25,10 @@ const client = solr.createClient('127.0.0.1', '8983', 'gettingstarted', '/solr')
// .q({poke_txt_en : 'bulbasaur'})
// .start(0)
// .rows(10);
let filter
$("select").change(function(){
filter=$("select").val()
});
let searchButton = document.getElementById('searchButton')
searchButton.addEventListener("click", search, false)
......@@ -62,7 +66,9 @@ function sendNameQuery(q){
.qf({poke_txt_en : 0.2 , about_txt_en : 3.3})
.mm(0)
.start(0)
.rows(10);
.rows(10)
if(filter)
query.matchFilter('types_features_str', test)
console.log(query);
client.search(query,function(err,obj){
......
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