Sunday, 15 June 2014

java - fetch only related values of hashtags from name in search functionality -


I am working in java and postgresql.
One of my table names is 'video' and one of the field names 'video_name', therefore, can include #tag values ​​in the video name like

  1. My FAV Star #tom
  2. Happy weekend # buddies #party masti
  3. with #seefood #friends
  4. Go with #friendsEnjoy

Now in this case, I'm only going to this field on 'video_name' Searching with the hashtag If I search for a # friend then I will get 2,3 videos.

I want to know what to ask in this matter

I have tried to use the query

From those videos
  Select * where video_nahIILI '% # friends'  

but this is not giving me the exact result.

I have also tried this question from the video

  where video_name ~ * '# friends'  

but the above query By using I got 3 results 2,3,4 and only me 2 & amp; 3.

/ ************************************************************************ **************************************************************************************************** **************************************************************************************************** ************************** Here is the answer to the above question thanks to @ Alex Video which contains the hashtag position next to the string and then with the # tag next to the new string.

  Video where less (video_name) than 'SELECT *' # friends (\ s% | \ #%) '? Video from 

  SELECT * where video_name 'REGEXP' #friends'  

and if you need it then the postgresql version is:

  SELECT * WHERE video_NA with the same as '% # buddy%' from the video  

Another example is how to solve the sensitivity of the case

  SELECT * where the video is less (video_NA) is similar to '% # friends%'  

Edit and with Location Checking:

  Choose Video Where the same low (Veedio_nam)% Friends (\ s% | \ #%)? '  

No comments:

Post a Comment