I have a database in Firestore like this "collection: posts->Document: PostId - >fields:(title, author, likes, content)" now I my website's search bar I want to search titles similar to those the user input, I want to show document if its time has any of the word given by the user
I tried this:
const sentence ="Looking For some posts";
const keywords = sentence.split(" ");
const filteredKeywords = keywords.filter(
(keyword) => !stopWords.includes(keyword)
);
console.log(filteredKeywords);
const SearchIdeasRef = collection(db, "Ideas");
const q = query(SearchIdeasRef, where("title", "in", filteredKeywords));
const IdeaSnapshots = await getDocs(q);
But the problem is it checks the word like"posts" with the whole string of title