![]() ![]() Let’s search for a convertible device that can be used as desktop and laptop as I talked about earlier. Now I will go into our IT Store database to show you some real world examples. ![]() ![]() The to_tsquery() accepts conditions that it uses to compare with the output of to_tsvector() function.įor example, if you’re looking for ‘laptop and desktop’, you should put ‘laptop & desktop’ to to_tsquery() function.įor ‘laptop or desktop’, the condition should be ‘laptop | desktop’. WHERE to_tsvector (fieldName ) to_tsquery (conditions ) ![]() In this section, I will show you how to add these on PostgreSQL.įirst, create a new database with the following command: Setting Up PostgreSQL for Full Text Searchīefore you can practice Full Text Search on PostgreSQL along with me, you have to set up PostgreSQL with some dummy data. In this article, I will show you how to perform Full Text Search with PostgreSQL. Where an ordinary search fails, Full Text Search rescues. This is where Full Text Search comes into play. You do want to your website to list all the convertible computers you have in stock when users do a search query like that. If the users can’t find it, you won’t get any sales. But you do have many convertible tablets that can be used as a desktop and a laptop in your store’s database. Since the search failed to show any result to the user, the user may think you’re out of stock or you don’t have it in your IT store. The user probably wanted to list all the computers in your store that he or she can use as a desktop and a laptop, most likely a convertible tablet. But do you actually have any product that is a desktop and a laptop? Do you even have a product whose title says ‘XXX Desktop and Laptop’ exactly as the user searched for? Most probably no! The search would fail to show any relevant results. Let’s say you have an IT store and the user searched for ‘desktop and laptop’. Let’s look at a real life scenario, then you will be clear on what Full Text Search is and what is the need for it. If there’s a slight mismatch, for example let’s say you have ‘x y_z’, the database will fail to show any result. What that means is, when users search for ‘x y z’, the PostgreSQL database looks for ‘x y z’ in exact order in the fields of a certain table. Full Text Search is used by search engines, shops, and many other websites all around the world.īy default, searches on PostgreSQL database are exact. Full Text Search is supported in PostgreSQL. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |