grav-plugin-tntsearch
grav-plugin-tntsearch copied to clipboard
Multiple filters
Hey, guys. I need to release search form with: category drop-list, text input named "name" and another one named "profession". All of them should work at the same time and specify the content.
For example imagine a catalog of people with different professions, names, and categories. If type "Jhon" in the field "Name" it is going to rid off all over, but it keeps all "John's" with different professions and categories. If I type "engineer" in profession field, it is going to leave all "Jhon's" with engineer profession.
Does your plugin provide such kind of functionality? Can I work with droplists? Do you have API?
I re-reaad the documentation. I think it could be possible by adding custom fields.
But there are no instructions how can I do that? I see the pieces of code in tntsearch.php
but I still do not understand what should i do to add one more field
It’s certainly possible to index different fields but the problem is tntsearch (the actual library we use) has no way to filter or specify fields during query. This is something that they say they will add but it’s not there yet. All you can do is get results back then load the objects for each item and further filter manually in php. Far from ideal.
Yes. What I found is GravTNTSearch.php
file, where onTNTSearchQuery
event is firing. So I guess I need to make fixes here or maybe make them right before render, as you said when I got result from tnt search. Need to think about it.
Thanks.
Ok. I digged deeply to the core of TNT search. I guess there is no reason to do something with that, because all aechitecture of search engine is specified of 1 word or phrase search.
My case is more like this one https://github.com/ash0080/grav-plugin-cascade-filters
@rhukster there is big API right here https://learn.getgrav.org/15/api May I ask you to give me a hint, where I can find info how to get all Gav pages with specific taxonomies?
My suggestion is to look at the taxonomy plugin. It does just that.
Ok. May I ask you to share the link? or did you meant this one? https://github.com/getgrav/grav-plugin-taxonomylist
I belive this one should work too https://github.com/ash0080/grav-plugin-cascade-filters
First one was the one I was referring to. Not familiar with second.