Filter out attributes that don’t contain the searched string

How can I filter out attributes that don’t contain the searched string?

init(opts) {
const helper = opts.helper;
const input = document.querySelector(’#searchbox’);
input.addEventListener(‘input’, ({currentTarget}) => {
render(options) {
const results = options.results;
var img = document.createElement(“img”);
img.src = “image.png”;
var src = document.getElementById(“clearfix”);
document.querySelector(’#hits’).innerHTML = results.hits
hit => <div id="clearfix" > ${instantsearch.highlight({ attribute: 'CONTENT', hit })} ${instantsearch.highlight({ attribute: 'GAIYO', hit })} ${instantsearch.highlight({ attribute: 'LOCATION', hit })} </div>

Hi @ynaka, you may need to save the query in a variable that can be accessed in your hits loop. Then check the query against the hit.attribute to see if it contains the query. Something like if (hit.GAIYO.includes(query)) …