Skip to content
Snippets Groups Projects
Commit 22da456b authored by Eike Cochu's avatar Eike Cochu
Browse files

added link ellipsis, regenerating windows on modeling

parent d7dad3bd
Branches
No related tags found
No related merge requests found
...@@ -156,7 +156,13 @@ public class FilebaseWindowIndex { ...@@ -156,7 +156,13 @@ public class FilebaseWindowIndex {
return window; return window;
} }
private void resizeWindows() { public void clear() {
windowSizes.clear();
windowDates.clear();
windowMap.clear();
}
public void resizeWindows() {
final List<Date> dates = new ArrayList<>(windowMap.keySet()); final List<Date> dates = new ArrayList<>(windowMap.keySet());
Collections.sort(dates); Collections.sort(dates);
windowSizes = new ArrayList<>(windowMap.size()); windowSizes = new ArrayList<>(windowMap.size());
......
...@@ -106,7 +106,13 @@ public class Analyzer { ...@@ -106,7 +106,13 @@ public class Analyzer {
BufferedReader in; BufferedReader in;
final FilebaseWordIndex wordIndex = new FilebaseWordIndex(modelDir);
final FilebaseIDDateIndex idDateIndex = new FilebaseIDDateIndex(modelDir);
final FilebaseWindowIndex windowIndex = new FilebaseWindowIndex(modelDir, modelConfig.getWindowResolution());
if (!reread) { if (!reread) {
recalcWindows(idDateIndex, windowIndex);
final Process p = Runtime.getRuntime().exec(command, null); final Process p = Runtime.getRuntime().exec(command, null);
if (!p.isAlive()) if (!p.isAlive())
throw new AnalyzerException("dtm process is dead"); throw new AnalyzerException("dtm process is dead");
...@@ -160,10 +166,6 @@ public class Analyzer { ...@@ -160,10 +166,6 @@ public class Analyzer {
p.waitFor(); p.waitFor();
} }
final FilebaseWordIndex wordIndex = new FilebaseWordIndex(modelDir);
final FilebaseIDDateIndex idDateIndex = new FilebaseIDDateIndex(modelDir);
final FilebaseWindowIndex windowIndex = new FilebaseWindowIndex(modelDir, modelConfig.getWindowResolution());
final int topicCount = modelConfig.getkTopics(); final int topicCount = modelConfig.getkTopics();
assert topicCount > 0; assert topicCount > 0;
...@@ -512,4 +514,11 @@ public class Analyzer { ...@@ -512,4 +514,11 @@ public class Analyzer {
return msg.length() - 1; return msg.length() - 1;
} }
private void recalcWindows(final FilebaseIDDateIndex idDateIndex, final FilebaseWindowIndex windowIndex) throws IOException {
windowIndex.clear();
for (final FilebaseIDDateIndexEntry date : idDateIndex)
windowIndex.add(date.getDate());
windowIndex.sync();
}
} }
<div class="link-wrapper"> <div class="link-wrapper">
<span class="menu-padding"> <span class="menu-padding ellipsis">
<a class="article-link" ui-sref="articles.show({id:article.id})" ng-attr-title="{{::article.title}}">
<span ng-bind="article.title"></span>
<ng-transclude/>
</a>
<div class="pull-right article-dropdown"> <div class="pull-right article-dropdown">
<i class="fa text-muted pointer" ng-class="{'fa-chevron-down':!excerptShown,'fa-chevron-up':excerptShown}" ng-click="toggleExcerpt()" ng-if="::showExcerpt" analytics-on analytics-event="Article excerpt" analytics-category="Article actions"></i> <i class="fa text-muted pointer" ng-class="{'fa-chevron-down':!excerptShown,'fa-chevron-up':excerptShown}" ng-click="toggleExcerpt()" ng-if="::showExcerpt" analytics-on analytics-event="Article excerpt" analytics-category="Article actions"></i>
<span class="badge" ng-bind="::article.topicsCount" ng-attr-title="{{::article.topicsCount}} topic(s)" ng-if="::showBadge"></span> <span class="badge" ng-bind="::article.topicsCount" ng-attr-title="{{::article.topicsCount}} topic(s)" ng-if="::showBadge"></span>
</div> </div>
<a class="article-link" ui-sref="articles.show({id:article.id})" ng-attr-title="{{::article.title}}">
<span ng-bind="article.title"></span>
<ng-transclude/>
</a>
</span> </span>
<article-menu class="menu-button" article="article" ng-if="::showMenu" /> <article-menu class="menu-button" article="article" ng-if="::showMenu" />
<div ng-bind="excerpt" ng-if="excerptShown" class="excerpt"></div> <div ng-bind="excerpt" ng-if="excerptShown" class="excerpt"></div>
......
<div class="link-wrapper"> <div class="link-wrapper">
<span class="menu-padding"> <span class="menu-padding ellipsis">
<span class="badge pull-right" ng-bind="::topic.articlesCount" ng-attr-title="{{::topic.articlesCount}} article(s)" ng-if="::showBadge"></span>
<a class="topic-link" ui-sref="topics.show({id:topic.id})" ng-attr-title="{{::topic.name}}"> <a class="topic-link" ui-sref="topics.show({id:topic.id})" ng-attr-title="{{::topic.name}}">
<span ng-bind="topic.name"></span> <span ng-bind="topic.name"></span>
<ng-transclude/> <ng-transclude/>
</a> </a>
<span class="badge pull-right" ng-bind="::topic.articlesCount" ng-attr-title="{{::topic.articlesCount}} article(s)" ng-if="::showBadge"></span>
</span> </span>
<topic-menu topic="topic" class="menu-button" ng-if="::showMenu" /> <topic-menu topic="topic" class="menu-button" ng-if="::showMenu" />
</div> </div>
...@@ -41,11 +41,6 @@ ...@@ -41,11 +41,6 @@
Vipra.windowLabel = function(date, res) { Vipra.windowLabel = function(date, res) {
date = moment(date); date = moment(date);
var parts = []; var parts = [];
if (res === 'QUARTER') {
parts.push('Q' + date.quarter());
parts.push(' ');
parts.push(date.year());
} else {
switch (res) { switch (res) {
case 'SECOND': case 'SECOND':
parts.push(Vipra.zeroPad(date.second())); parts.push(Vipra.zeroPad(date.second()));
...@@ -69,7 +64,27 @@ ...@@ -69,7 +64,27 @@
case 'YEAR': case 'YEAR':
parts.push('-'); parts.push('-');
parts.push(date.year()); parts.push(date.year());
} break;
case 'WEEK':
parts.push('W' + date.week());
parts.push(' ');
parts.push(date.year());
break;
case 'SEMESTER':
parts.push('S' + date.month() < 6 ? 1 : 2);
parts.push(' ');
parts.push(date.year());
break;
case 'TRIMESTER':
var month = date.month();
parts.push('T' + month < 4 ? 1 : month < 8 ? 2 : 3);
parts.push(' ');
parts.push(date.year());
break;
case 'QUARTER':
parts.push('Q' + date.quarter());
parts.push(' ');
parts.push(date.year());
} }
var rtrim = /^[\s\uFEFF\xA0:-]+|[\s\uFEFF\xA0:-]+$/g; var rtrim = /^[\s\uFEFF\xA0:-]+|[\s\uFEFF\xA0:-]+$/g;
return parts.reverse().join('').replace(rtrim, ''); return parts.reverse().join('').replace(rtrim, '');
......
...@@ -53,4 +53,8 @@ public class CountMap<T> { ...@@ -53,4 +53,8 @@ public class CountMap<T> {
return map.containsKey(key); return map.containsKey(key);
} }
public void clear() {
map.clear();
}
} }
...@@ -3,6 +3,7 @@ package de.vipra.util.service; ...@@ -3,6 +3,7 @@ package de.vipra.util.service;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -110,6 +111,20 @@ public class MongoService<Type extends Model<IdType>, IdType> { ...@@ -110,6 +111,20 @@ public class MongoService<Type extends Model<IdType>, IdType> {
return getMultiple(QueryBuilder.builder().fields(true, fields)); return getMultiple(QueryBuilder.builder().fields(true, fields));
} }
public Iterator<Type> getAllIterator(final QueryBuilder builder) {
final Query<Type> query = datastore.createQuery(clazz);
if (builder != null) {
builder.build(query);
if (builder.getFields() == null && !builder.isAllFields() && ignoredFieldsMultiQuery.length > 0) {
query.retrievedFields(false, ignoredFieldsMultiQuery);
}
} else if (ignoredFieldsMultiQuery.length > 0) {
query.retrievedFields(false, ignoredFieldsMultiQuery);
}
return query.iterator();
}
public Type createSingle(final Type t) throws DatabaseException { public Type createSingle(final Type t) throws DatabaseException {
if (t == null) if (t == null)
throw new DatabaseException(new NullPointerException("entity is null")); throw new DatabaseException(new NullPointerException("entity is null"));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment