Skip to content

Commit c89d271

Browse files
committed
refine ui
1 parent 7317fb5 commit c89d271

23 files changed

+51
-56
lines changed

TweetMapBackend/readMe.txt

Lines changed: 9 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
1-
curl -X PUT "https://search-database-yp7n3mmtmp6fybvuhvst6o6bxa.us-west-2.es.amazonaws.com/twitters/twitterEntities/_mapping" -d '{
2-
"twitterEntities" : {
1+
2+
curl -X PUT "https://search-database-yp7n3mmtmp6fybvuhvst6o6bxa.us-west-2.es.amazonaws.com/stream" -d '{
3+
"index": {
4+
}}'
5+
6+
7+
8+
curl -X PUT "https://search-database-yp7n3mmtmp6fybvuhvst6o6bxa.us-west-2.es.amazonaws.com/stream/tweets/_mapping" -d '{
9+
"tweets" : {
310
"properties" : {
411
"createdAt" : { "type" : "string" },
512
"location" : { "type" : "geo_point"},
@@ -10,27 +17,3 @@ curl -X PUT "https://search-database-yp7n3mmtmp6fybvuhvst6o6bxa.us-west-2.es.ama
1017
"username":{"type" : "string" }
1118
}}
1219
}'
13-
14-
15-
curl -X PUT "https://search-database-yp7n3mmtmp6fybvuhvst6o6bxa.us-west-2.es.amazonaws.com/twitters" -d '{
16-
"index": {
17-
}}'
18-
19-
20-
-------------------
21-
curl -X PUT "https://search-daybvuhvst6o6bxa.us-west-2.es.amazonaws.com/twitters" -d '{
22-
> "index": {
23-
> }}'
24-
{"acknowledged":true,"shards_acknowledged":true}Zmy-Apple@MingyangdeMacBook-Pro:~$ cybvuhvst6o6bxa.us-west-2.es.amazonaws.com/twitters/twitterEntities/_mapping" -d '{
25-
"twitterEntities" : {
26-
"properties" : {
27-
"createdAt" : { "type" : "string" },
28-
"location" : { "type" : "geo_point"},
29-
"keyword": { "type" : "string" },
30-
"place": {"type" : "string" },
31-
"text": {"type" : "string" },
32-
"tweetId": { "type": "long" },
33-
"username":{"type" : "string" }
34-
}}
35-
}'
36-
{"acknowledged":true}Zmy-Apple@MingyangdeMacBook-Pro:~$

TweetMapBackend/src/main/java/hello/Application.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
public class Application {
1212
public static void main(String[] args) {
1313
SpringApplication.run(Application.class, args);
14+
//
1415
// ClassPathXmlApplicationContext context =
1516
// new ClassPathXmlApplicationContext("applicationContext.xml");
1617
//
@@ -19,6 +20,8 @@ public static void main(String[] args) {
1920
//
2021
// twitterStreamHandler.inject();
2122

23+
24+
2225
// ElasticSearchService elasticSearchService =
2326
// context.getBean("elasticSearchService", ElasticSearchService.class);
2427
//

TweetMapBackend/src/main/java/hello/ElasticSearchService.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public class ElasticSearchService {
2828

2929
private JestClient client = null;
3030

31-
private static long docId = 2877;
31+
private static long docId = System.currentTimeMillis();
3232

3333

3434
@Autowired
@@ -43,7 +43,8 @@ public ElasticSearchService(@Value("${es.endpoint}") String endPoint) {
4343

4444
public void indexDocument(TweetEntity tweetEntity) {
4545
Index index = new Index.Builder(tweetEntity).index(INDEX)
46-
.type(TYPE).id(docId + "").build();
46+
.type(TYPE)//.id(docId + "")
47+
.build();
4748
try {
4849

4950
client.execute(index);

TweetMapBackend/src/main/java/hello/TwitterStreamHandler.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public class TwitterStreamHandler {
2828
@Value("${key.accessTokenSecret}")
2929
private String accessTokenSecret;
3030

31-
private String[] keywords = {"job", "love", "game", "fashion", "trump", "New York","fashion", "food", "lol","hilary", "hello"};
31+
private String[] keywords = { "sports", "family", "movie", "google", "apple", "amazon", "fashion", "food","song", "study"};
3232

3333
public void inject() {
3434
ConfigurationBuilder cb = new ConfigurationBuilder();
@@ -60,8 +60,11 @@ public void onStatus(Status status) {
6060
keyword = keywords[i];
6161
}
6262
}
63-
TweetEntity tweetEntity = new TweetEntity(keyword, username, place, longitude, latitude, tweetId, text, createdAt);
64-
elasticSearchService.indexDocument(tweetEntity);
63+
if (keyword != null) {
64+
TweetEntity tweetEntity = new TweetEntity(keyword, username, place, longitude, latitude, tweetId, text, createdAt);
65+
elasticSearchService.indexDocument(tweetEntity);
66+
}
67+
6568

6669
}
6770
}

TweetMapBackend/src/main/resources/application.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ key.accessToken=827004953310949377-6ZUtvrRUClLDvUgnaBArSSM71j09AD6
44
key.accessTokenSecret=Ni0TPMbYNhh13wC470rzxGE7bhrPhpkv4onueZfjoCvpk
55

66
es.endpoint=https://search-database-yp7n3mmtmp6fybvuhvst6o6bxa.us-west-2.es.amazonaws.com
7-
es.index=twitters
8-
es.type=twitterEntities
7+
es.index=stream
8+
es.type=tweets

TweetMapBackend/src/main/resources/static/inline.bundle.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)