sort by: | sort by: | ||||
<select name="sort" id="sort"> | <select name="sort" id="sort"> | ||||
<option value="relevance">relevance</option> | <option value="relevance">relevance</option> | ||||
<option value="year">year</option> | |||||
<option value="year desc">year descending</option> | |||||
<option value="year asc">year ascending</option> | |||||
</select> | </select> | ||||
<input type="submit" id="submit" value="search"> | <input type="submit" id="submit" value="search"> | ||||
</form> | </form> |
sort by: | sort by: | ||||
<select name="sort" id="sort" onchange="this.form.submit()"> | <select name="sort" id="sort" onchange="this.form.submit()"> | ||||
<option value="relevance" <?php if($_POST["sort"] == 'relevance') echo "selected"; ?>>relevance</option> | <option value="relevance" <?php if($_POST["sort"] == 'relevance') echo "selected"; ?>>relevance</option> | ||||
<option value="year" <?php if($_POST["sort"] == 'year') echo "selected"; ?>>year</option> | |||||
<option value="year desc" <?php if($_POST["sort"] == 'year desc') echo "selected"; ?>>year descending</option> | |||||
<option value="year asc" <?php if($_POST["sort"] == 'year asc') echo "selected"; ?>>year ascending</option> | |||||
</select> | </select> | ||||
<noscript> | <noscript> | ||||
<input type="submit" class="btn btn-default" value="Set" /> | <input type="submit" class="btn btn-default" value="Set" /> |
} | } | ||||
else{ | else{ | ||||
// Assemble a query string to send to Solr. This uses the Solr hostname from config.env. Solr's query syntax can be found at many sites including https://lucene.apache.org/solr/guide/6_6/the-standard-query-parser.html | // Assemble a query string to send to Solr. This uses the Solr hostname from config.env. Solr's query syntax can be found at many sites including https://lucene.apache.org/solr/guide/6_6/the-standard-query-parser.html | ||||
$solrurl = 'http://' . $_ENV["SOLR_HOSTNAME"] . ':' . $_ENV["SOLR_PORT"] . '/solr/' . $core . '/select?q.op=OR&q=content%3A' . $search . '&wt=json&sort=' . $sort . '%20asc'; | |||||
$solrurl = 'http://' . $_ENV["SOLR_HOSTNAME"] . ':' . $_ENV["SOLR_PORT"] . '/solr/' . $core . '/select?q.op=OR&q=content%3A' . $search . '&wt=json&sort=' . urlencode($sort); | |||||
} | } | ||||
// Perform Curl request on the Solr API | // Perform Curl request on the Solr API |