search is completely working in frontend now
This commit is contained in:
@@ -30,21 +30,22 @@ $(document).ready(function() {
|
|||||||
// })
|
// })
|
||||||
//};
|
//};
|
||||||
|
|
||||||
|
// what are we looking for?
|
||||||
|
what = $inputField.attr('what');
|
||||||
|
|
||||||
// Input binding
|
// Input binding
|
||||||
$inputField.on('keyup change', function() {
|
$inputField.on('keyup change', function() {
|
||||||
var query = $inputField.val();
|
var query = $inputField.val();
|
||||||
|
|
||||||
if(query === undefined) { return; }
|
if(query === undefined) { return; }
|
||||||
|
|
||||||
toggleIconEmptyInput(!query.trim());
|
toggleIconEmptyInput(!query.trim());
|
||||||
search.setQuery(query);
|
// what could be like "/users"
|
||||||
|
search.setQuery(query, what);
|
||||||
//setURLParams(search);
|
//setURLParams(search);
|
||||||
search.execute();
|
search.execute();
|
||||||
}).focus();
|
}).focus();
|
||||||
|
|
||||||
// AlgoliaHelper events
|
|
||||||
//helper.on('change', function(state) {
|
|
||||||
//setURLParams(search);
|
|
||||||
//});
|
|
||||||
|
|
||||||
search.on('results', function(content){
|
search.on('results', function(content){
|
||||||
renderStats(content);
|
renderStats(content);
|
||||||
renderHits(content);
|
renderHits(content);
|
||||||
@@ -54,8 +55,6 @@ $(document).ready(function() {
|
|||||||
renderFirstHit($(hits).children('.search-hit:first'));
|
renderFirstHit($(hits).children('.search-hit:first'));
|
||||||
});
|
});
|
||||||
|
|
||||||
//});
|
|
||||||
|
|
||||||
/***************
|
/***************
|
||||||
* SEARCH RENDERING
|
* SEARCH RENDERING
|
||||||
* ***********/
|
* ***********/
|
||||||
@@ -93,7 +92,6 @@ $(document).ready(function() {
|
|||||||
|
|
||||||
// Initial search
|
// Initial search
|
||||||
initWithUrlParams();
|
initWithUrlParams();
|
||||||
//helper.search();
|
|
||||||
|
|
||||||
function convertTimestamp(timestamp) {
|
function convertTimestamp(timestamp) {
|
||||||
var d = new Date(timestamp * 1000), // Convert the passed timestamp to milliseconds
|
var d = new Date(timestamp * 1000), // Convert the passed timestamp to milliseconds
|
||||||
@@ -120,7 +118,6 @@ $(document).ready(function() {
|
|||||||
function renderHits(content) {
|
function renderHits(content) {
|
||||||
var hitsHtml = '';
|
var hitsHtml = '';
|
||||||
for (var i = 0; i < content.hits.length; ++i) {
|
for (var i = 0; i < content.hits.length; ++i) {
|
||||||
// console.log(content.hits[i]);
|
|
||||||
var created = content.hits[i].created;
|
var created = content.hits[i].created;
|
||||||
if (created) {
|
if (created) {
|
||||||
content.hits[i].created = convertTimestamp(created);
|
content.hits[i].created = convertTimestamp(created);
|
||||||
@@ -161,7 +158,6 @@ $(document).ready(function() {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
console.log('FACETS');
|
|
||||||
var facets =[];
|
var facets =[];
|
||||||
var aggs = content.aggs;
|
var aggs = content.aggs;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user