33
Views
2
Comments
Search functionality multiple attributes same keyword
Question

Hi all,

I'm currently building a search field that can search on adress.

Now the adress is stored as multiple attributes in the database. (Street, housenumber, addition, housenumber, city)

When the user searches on a string that contains the street and the housenumber it should return the right records that relate to the search.

However, the user can also search in an different order for example housenumberand than the street. This should give the same results

I could make it (partial) work when i create a string of all adress attributes (and add a space between each attribute) and use the like % + keyword + %. However, than it only works if the user explicitely searches in the order the string is being build. Since it should be possible to search in a different order, this is not optimal.

Any tips on how to do this in an aggregate? Prefer to not use SQL for this in case possible.

Thanks!

Bash Nie

I am not aware of any fancy regex to get this done. 

Any solution i know will not be efficient so i woudl recommend to have designated search fields ( separate for street, housenr etc.)


the only thing i can come up with is that you  use the string_split to separate the different items in your searchstring and then use every possible combination to find a match.


Hi all, I am actually having exactly the same question, so it would be great to know if there is any solution available in the meanwhile.


Thanks

Leon

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.