How Can I Query And Get Data From My Sqlite Database Even When My Search Input Have Similar Words That Is Apart From Each Other (not Continuously)
I have a blog search function on my website. This is my search input: children lazy I have a column in my SQLite database that is called: Children is getting lazy I use the codes(P
Solution 1:
split the sraach string by white space and join with '%'
# split words and join with "%"
search_string = "%" + "%".join(search_data.split()) + "%"
many_posts0 = BlogPost.query.filter(or_((BlogPost.problem_name.ilike(search_string)),(BlogPost.text.ilike("%" + form.search.data + "%")))).order_by(BlogPost.date.desc())
Post a Comment for "How Can I Query And Get Data From My Sqlite Database Even When My Search Input Have Similar Words That Is Apart From Each Other (not Continuously)"