Search in tags and structure field

I’m trying to implement a search functionality on a page. So, I followed this tutorial and it pretty much works as expected.

However, I also want to search the tags and structure fields, not only text and title. To do this, I thought that I just needed to change the following line:

$results = $site->index()->visible()->search($query, 'title|text|tags|structure');

But for whatever reason this won’t work. What am I doing wrong?

Are your fields called tags and structure? You can leave the second argument empty if you want, then search should search all fields.

Thanks, I don’t know what happened and what I did earlier, but it’s working now.