Generally in RDBMS we use to to the searching using the character like % and * or LIKE , IN key word and we get the result. But in general doing this type of generallization or casing or puralzation is not good practise. So in Couchbase they had give the option of full text search.
What Full text search means. Let say we want to search the text “this is good and bad” in RDBMS we can use the LIKE with % to get this values. But as soon as you change the values inside the search context i.e. instead of LIKE %this is good and bad% if I try to give LIKE %this IS Good and bad% it will not give me the result.
So Full text search means we can search the full text easily without thiking of this LIKE %% symbole. i.e. i can be able to search the text given belwo that will give me the out that match all these
this is good and bad
This is good and bad
this IS good and bad
this good and bad
this is good bad
All this can give allowed in one searh as a full text and that can be done with the help of Full text search.
To do this by using the search option from the left side and click on Add Index.
Then fill all the necessary information as shown below on the field on which we want to do full search as shown below.
Here we have to give the data value of column name "type"
i.e in our case we have following filed and i want the search to be happening in column "type " i.e in sql language we called it where type = "%hotel%"
If needed you can also create alias for the same as shown in the belwo figure
for more information please visit to the belwo url
https://blog.couchbase.com/n1ql-and-search-how-to-leverage-fts-index-in-n1ql-query/
To better understand let say we have following data in our bucket
and we have following Fulltext search
Now lets do the search i.e if we search for the siddhu3 we will get only one record
if we now search for new siddhu3 in that case we will get all the record because all record have “new” keyword
Note:- we will get the same result as above for search of
new si
new
new siddhu
you can also get the running curl command for your full text search as shown below and execute it on you curl prompt
1 2 3 4 5 6 7 8 9 10 11 12 | curl -XPOST -H "Content-Type: application/json" \ -u admin:admin1 http://localhost:8094/api/index/siddhuSearchIndex/query \ -d '{ "explain": false, "fields": [ "*" ], "highlight": {}, "query": { "query": "siddhu3" } }' |
No comments:
Post a Comment