Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- JSON SOURCE
- =============
- {
- "took" : 3,
- "timed_out" : false,
- "_shards" : {
- "total" : 5,
- "successful" : 5,
- "failed" : 0
- },
- "hits" : {
- "total" : 5,
- "max_score" : 2.252763,
- "hits" : [ {
- "_index" : "twitter",
- "_type" : "tweet",
- "_id" : "458132986852958208",
- "_score" : 2.252763, "_source" : {"text":"RT @AhmasZain: Massive respect to #mh192 pilot? He's only doing his job,job well done. What about the garbage collector doing his job? No m…","tweet_sentiment":1,"created_at":"2014-04-21T06:39:50.000Z","source":"<a href=\"http://twitter.com/download/iphone\" rel=\"nofollow\">Twitter for iPhone</a>","truncated":false,"mention":[{"id":354484183,"name":"Ahmas Zain","screen_name":"AhmasZain"}],"retweet_count":0,"retweet":{"id":458076965124075520,"user_id":354484183,"user_screen_name":"AhmasZain","retweet_count":1},"hashtag":[{"hashtag_text":"mh192"}],"link":[],"user":{"id":593217546,"name":"S.Devaraj","screen_name":"devaraaj17","location":"Australia, BNE. ","description":"If you wanna get with me,\nThere's some things you gotta know;\nI like my beats fast,\nAnd my bass down low."}}
- }, {
- "_index" : "twitter",
- "_type" : "tweet",
- "_id" : "458132982365036544",
- "_score" : 1.4054651, "_source" : {"text":"What happen ? #MH192","tweet_sentiment":2,"created_at":"2014-04-21T06:39:49.000Z","source":"<a href=\"http://twitter.com/#!/download/ipad\" rel=\"nofollow\">Twitter for iPad</a>","truncated":false,"mention":[],"retweet_count":0,"hashtag":[{"hashtag_text":"MH192"}],"link":[],"user":{"id":386339267,"name":"mileymana","screen_name":"manarina_SS","location":"BANGERZ Tour","description":"23rd June 98. A Smiler. Miley Cyrus ❤️ IG- manarina_m Imagine Dragons"}}
- }, {
- "_index" : "twitter",
- "_type" : "tweet",
- "_id" : "458132919685378048",
- "_score" : 1.287682, "_source" : {"text":"STOP LA SIA PASAL #MH192 THAT FLIGHT DAH LAMA SAFELY LANDED. YG LU ORG SEMUA NK SPREAD LAGI FAKE NEWS WTF LA SIA!","tweet_sentiment":1,"created_at":"2014-04-21T06:39:34.000Z","source":"<a href=\"https://twitter.com/download/android\" rel=\"nofollow\">Twitter for Android</a>","truncated":false,"mention":[],"retweet_count":0,"hashtag":[{"hashtag_text":"MH192"}],"link":[],"user":{"id":914540778,"name":"garrix.","screen_name":"akemwilson","location":"ig: akemwilson | JHB-MLK","description":"20. #halamadrid"}}
- }, {
- "_index" : "twitter",
- "_type" : "tweet",
- "_id" : "458133042427469824",
- "_score" : 1.287682, "_source" : {"text":"RT @MyschaMorgana: #MH192 tyre burst out last night >.< http://t.co/CpHo9bgYn8","tweet_sentiment":1,"created_at":"2014-04-21T06:40:03.000Z","source":"<a href=\"http://twitter.com/download/android\" rel=\"nofollow\">Twitter for Android</a>","truncated":false,"mention":[{"id":318342349,"name":"♥Naya Na Honey♥","screen_name":"MyschaMorgana"}],"retweet_count":0,"retweet":{"id":458122907579715584,"user_id":318342349,"user_screen_name":"MyschaMorgana","retweet_count":14},"hashtag":[{"hashtag_text":"MH192"}],"link":[],"user":{"id":2274572706,"name":"amiricious khan ∞","screen_name":"PKreko","location":"","description":"Seventeen♡ Full time daughter ♡ past, present, future. 10.11.2012 & 20.01.2013, insyaAllah✌"}}
- }, {
- "_index" : "twitter",
- "_type" : "tweet",
- "_id" : "458133204327612416",
- "_score" : 1.1976817, "_source" : {"text":"RT @izreloaded: Passengers of #MH192 will be making their next flight to Bangalore, India at 3pm today. #PrayForMH192","tweet_sentiment":1,"created_at":"2014-04-21T06:40:42.000Z","source":"<a href=\"https://mobile.twitter.com\" rel=\"nofollow\">Mobile Web (M2)</a>","truncated":false,"mention":[{"id":8934712,"name":"IZ Reloaded","screen_name":"izreloaded"}],"retweet_count":0,"retweet":{"id":458110420507566080,"user_id":8934712,"user_screen_name":"izreloaded","retweet_count":2},"hashtag":[{"hashtag_text":"MH192"},{"hashtag_text":"PrayForMH192"}],"link":[],"user":{"id":420761335,"name":"Steve Einstein","screen_name":"MrSteveEinstein","location":"Malaysia ","description":"Capable of anything & everything. Student, Best Actor 2013 English Drama team, Loves Acting, Dramas & Movies. Full-time dreamer. INSTAGRAM: IAMSTEVE_EINSTEIN96"}}
- } ]
- }
- }
- hashtag based search
- ====================
- String[] hastags = request.getHashTags().split(",");
- FilterBuilder[] hashTagFilter = new FilterBuilder[hastags.length];
- for(int i=0;i<hastags.length;i++){
- String hashtag = hastags[i];
- hashTagFilter[i] = FilterBuilders.nestedFilter("hashtag", FilterBuilders.termFilter("hashtag_text", hashtag));
- }
- srb.setQuery(QueryBuilders.filteredQuery(QueryBuilders.matchAllQuery(), FilterBuilders.orFilter(hashTagFilter)));
- User name search
- ================
- srb.setQuery(QueryBuilders.filteredQuery(QueryBuilders.matchAllQuery(), FilterBuilders.termFilter("screen_name", request.getFromUser())));
Advertisement
Add Comment
Please, Sign In to add comment