What’s the best way to modify the SearchHints module to search across multiple columns and do a full text search? I don’t quite grasp how get_search_keys in the Server module is receiving what to search for (or if it’s not receiving a query now, how do I send one in)?
Meredydd has a great post about the most efficient way to ask a question, please review: How to access a drop down list from an ItemTemplate form
This is a very supportive forum, everyone here is willing to help if they understand what are you trying to accomplish. I would suggest that you rewrite your question based on the tips on the link, and I am pretty sure you will get your answer in no time.
In general, if you want to search across multiple columns, you might try to use Anvil’s powerful query operator.
For example, this query will return all rows that contain a particular string (represented by the variable text) and considers two columns in the search.
Query operators are powerful and there is a nice tutorial here explaining how to use them.
You will see in that tutorial that there is even a way to do an intelligent full-text search.
If you are asking how to pass a query along to a server function, one way to do that, as you can see above, is to pass your search text as an argument when you call your server function. Then, inside the server you can make use of that string.
Here is a simple app that uses the above query to autocomplete items in a repeating panel (similar to what SearchHints does).
Now, the SearchHints component, and companion example app, are a bit more complicated if you are a beginner (it confuses me a bit too). I would make sure you understand my basic app first.
The SearchHints example app does not use queries in a server function as I did above, rather it returns all rows from the data table to the client. Then, the SearchHints component filters the returned strings using standard python string methods (e.g., .startswith())
There are a few things that make the SearchHints functionality a bit confusing at first. Namely, the raise_event and set_event_handler methods. Once you understand these, it should make sense how the component and companion app are working together.
Please see the documentation on events and the SearchHints tutorial.
Finally, here is a modification of the SearchHints app that searches across multiple columns using query operators.