so is this all about fixing the search function so that i can have a search box like in twitter or google, or this bubble forum?
i have tried everything to get a search box that doesnt rely on having to type in an exact word, i want a search box that searches for relevancy, not exact match.
Actually, yes. Not sure why I hadnât thought of it before. It wonât work at the scale of a large forum, but should do for smaller searches.
Data âŚ
StringThing
Text
List of Words
WordThing
Text
List of Strings
Take your input with your words in it, and split them out using an âExtract with a Regexâ â[^â]+"|([^)]+)|[^"\s()]+ so this produces a list of words
Save your âstringâ of words. Run an API workflow on the list from step 1. Pass in the âstringâ thing and the text.
If the âwordâ doesnât already exist in WordThing, then Create it, and add it to the List of Words on String
If the âwordâ does exist in WordThing, then update the Word to add the string to the list, and add it to the List of Words on String as well.
This then gives you a list of words. You can use this in a search box, and then use the output of the search box to show that Wordâs list of Strings.
And there you go. Partial Word Search on the beginning of words only. So Alb, Albe, Alber etc
If you were really clever, you could then run API workflows on each word (you will need to limit the number of letters in a word I would think) and pull back all the internal combinations too. So âbertâ to match with Albert.
But at that level of complexity your might be better off spinning up an instance of ElasticSearch and using the API connector.
Will put in as an Example in BuildingOnBubble shortly.
I came up with a partial solution that works fairly well and allows me to search multiple fields (with a single part-word term). Itâs a basic adaptation of Advanced filters, although rather than truncating, I used Extract with Regex and a dynamic expression.
Add a custom state to the input field that will store a lowercase version of the search term
Add a workflow for When Inputâs Value is Changed so that the first step will update the custom state and the second will change the source of the repeating group to a new filtered list
The constraint looks something like, This Typeâs Field1:lowercase:Extract with Regex:count>0 or This Typeâs Field2:lowercase:Extract with Regex:count>0
I guess the one detail I should add is that I canât quite get the input field to function like an autocomplete. The workflow fires when the input value is changed, but this only occurs on a focus change (not a keystroke). Open to any ideas on how to improve this.
Hereâs a screenshot of the current solution. My search will pick up any text in the first name, last name, or email address. It is case insensitive and doesnât care about position within the text. You could easily adapt the regex to match the start of a word or term.
Would you mind elaborating a bit more on your solution. I couldnât follow your description well enough to play with the strategy. I see that youâre working on an example, but thought it might be nice to have a bit more detail here in the forum for brave bubblerâs who want to experiment further.
I actually tried a couple of more complex options before I settled on the simplest regex Iâve ever written. It is nothing but the search term (converted to lower case). For âInput Aâ, I have a custom state called âlowercaseâ defined. Within a workflow (When Input Aâs value is changed), I assign the value of âInput Aâs value:lowercaseâ to the custom state and then apply extract with regex to each field I want to test (where the regex is âInput Aâs lowercaseâ). Next I count the items in the result to determine whether there was a match.
I extended this a bit further to work with multiple search terms in an âORâ fashion. In this case, the custom state is called search_terms. Again, I apply the lowercase transformation followed by search and replace with another simple regex (swapping whitespace for the â|â). The regex is nothing more than the transformed string.
Having done this, the search term âAl Einâ becomes the regex âal|einâ, which will match Albert Einstien, Al Franken, Bob Feinstein, etc ⌠âORâ logic isnât perfect, but âANDâ would make for a much more complex solution given that Iâm searching multiple database fields. I suppose I could also get clever and sort based on the number of matched terms, but the current setup will work well for the size of user list Iâm trying to filter.
what do you mean by those quotations. do i literally type all of those quatations, slashes, and brackets into the extract with a regre, or do i fill something in between those brackets, quatations, etc?
I was trying to implement your solution but I cannot seem to understand if I am following the steps right.
From your instructions, I created StringThing as a type of data, with a field called String Text (list of wordthings), and I also created WordThing as a type of data, with a field called Wordthing Text (list of stringthings).
Workflow:
When Input Search is value is changed: Create a new StringThing, add this inputâs value:extract with regex (regex you provided)
âŚbut then I am not sure what to do
what am i missing here? i know for one, i am missing the role that Wordthing plays, its not clear in your instructions here:
i am looking at your solution. its is very intimidating to me because of its complexity but i will see which one works better for me, so far I have tried the solution NigelG has given and quickly got stuck, so I assume I would quickly get stuck trying to implement your solution too. I wonder if your solution will work for what I am trying to do with giving users the ability to search for posts from other users.
I implemented your solution. It is working fine. However, when I enter the value in input box once it shows the value correctly. However when I change the input, it does not show the data in the repeating group unless, I refresh the page. Any way around it
Iâve just published an article on Medium that outlines a simple implementation on Bubble of search-like functionality.
It can only search for the beginning or end of a text, but it works pretty well, and doesnât require workflows and other complex combinations.
[https://medium.com/@raz_855/building-a-bubble-is-search-filter-db80b8253d13](http://Building a-Bubble.is search filter)