Could you share your experiences related to global search or app-wide search?
I’m building a search in my application that basically consists of a search bar that searches more than one record type at once, including several fields of each record. Additionally, I would like to search files through its content.
I thought of some solutions:
1 - Perform direct searches on multiple types of records. Since I have many records and tables, I don’t see it as something performant.
2 - Create a new Search_Index table that will contain the information on the record type, indexed text and the unique id to find the object. This way, the search is done in only 1 table. In any case, I will need to keep this table updated with each addition, editing and removal of records.
3 - Use Algolia or similar type of service. But I noticed in the documentation that private tables and fields are not indexed. This is a delicate issue.
4 - Integrate with Azure Search, but I’m not sure how to populate the indexes.
You can create a Search datatype that contains a simple field concatenating strings used by the search. Then you can link that Search datatype record with the appropriate (Content) datatype record. This way you can easily search for different types of records and link them to the actual records they represent.
I have a paid plugin called Data Jedi that has a search box element that allows you to have dropdown suggested values via matching what user is typing on any data type (Bubble searchbox just does custom data types, but mine does option sets, api objects and plugin objects)…it also lets you match against multiple fields at once, so no need for idea #2 to create a new search_index.
It doesn’t by default have a built in function to enable searching multiple data types at once, but with some creativity and the plugins other features/functions you can essentially create a new api object that is all of your different data types combined (or if it is related data just a flattened and prefixed array) as the type of data to search.
Below is example video of searching across 4 different fields
The below screen shot shows a portion of how to set the multiple fields and the caption
You have to take into account the proper update of the Search datatype everytime the Content datatype changes.
The most convenient way is by setting Database trigger events watching the appropriate Content datatypes, so that updates are handled automatically by the backend. This has the downside of consuming 0.05 WU each time an observed record is created, modified or deleted.
If the WU consumption is too high for you, you can always update the Search datatype records from manually set workflows, triggered everytime the a Content datatype record is updated. This is more delicate and error prone.