modified hashtags for being non case sensitive

git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portal/social-networking-library@100650 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Massimiliano Assante 2014-10-13 16:23:47 +00:00
parent b5e55cc90a
commit 20e37ccc2f
3 changed files with 1724 additions and 5 deletions

File diff suppressed because it is too large Load Diff

Binary file not shown.

View File

@ -1443,9 +1443,10 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
// Inserting data
MutationBatch m = conn.getKeyspace().prepareMutationBatch();
for (String hashtag : noduplicatesHashtags) {
m.withRow(cf_HashtagTimeline, hashtag).putColumn(feedid, vreid, null);
String lowerCaseHashtag = hashtag.toLowerCase();
m.withRow(cf_HashtagTimeline, lowerCaseHashtag).putColumn(feedid, vreid, null);
boolean firstInsert = execute(m);
boolean secondInsert = updateVREHashtagCount(vreid, hashtag, true);
boolean secondInsert = updateVREHashtagCount(vreid, lowerCaseHashtag, true);
if (! (firstInsert && secondInsert)) {
_log.error("saveHashTags: Could not save the hashtag(s)");
return false;
@ -1465,9 +1466,10 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
// Inserting data
MutationBatch m = conn.getKeyspace().prepareMutationBatch();
for (String hashtag : noduplicatesHashtags) {
m.withRow(cf_HashtagTimeline, hashtag).deleteColumn(feedid);
String lowerCaseHashtag = hashtag.toLowerCase();
m.withRow(cf_HashtagTimeline, lowerCaseHashtag).deleteColumn(feedid);
boolean firstDelete = execute(m);
boolean secondInsert = updateVREHashtagCount(vreid, hashtag, false);
boolean secondInsert = updateVREHashtagCount(vreid, lowerCaseHashtag, false);
if (! (firstDelete && secondInsert)) {
_log.error("deleteHashTags: Could not delete the hashtag(s)");
return false;
@ -1509,8 +1511,9 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
List<Feed> toReturn = new ArrayList<Feed>();
OperationResult<Rows<String, String>> result = null;
try {
String lowerCaseHashtag = hashtag.toLowerCase();
result = conn.getKeyspace().prepareQuery(cf_HashtagTimeline)
.getKeySlice(hashtag)
.getKeySlice(lowerCaseHashtag)
.execute();
} catch (ConnectionException e) {
e.printStackTrace();