mirror of
https://github.com/sismics/docs.git
synced 2024-11-26 07:34:55 +01:00
More loading feedback (client)
This commit is contained in:
parent
464d43194b
commit
0bc658a396
@ -10,6 +10,7 @@ import java.util.Set;
|
|||||||
import org.apache.lucene.document.Field;
|
import org.apache.lucene.document.Field;
|
||||||
import org.apache.lucene.document.StringField;
|
import org.apache.lucene.document.StringField;
|
||||||
import org.apache.lucene.document.TextField;
|
import org.apache.lucene.document.TextField;
|
||||||
|
import org.apache.lucene.index.DirectoryReader;
|
||||||
import org.apache.lucene.index.IndexWriter;
|
import org.apache.lucene.index.IndexWriter;
|
||||||
import org.apache.lucene.index.Term;
|
import org.apache.lucene.index.Term;
|
||||||
import org.apache.lucene.queries.TermsFilter;
|
import org.apache.lucene.queries.TermsFilter;
|
||||||
@ -171,12 +172,17 @@ public class LuceneDao {
|
|||||||
TermsFilter userFilter = new TermsFilter(terms);
|
TermsFilter userFilter = new TermsFilter(terms);
|
||||||
|
|
||||||
// Search
|
// Search
|
||||||
IndexSearcher searcher = new IndexSearcher(AppContext.getInstance().getIndexingService().getDirectoryReader());
|
DirectoryReader directoryReader = AppContext.getInstance().getIndexingService().getDirectoryReader();
|
||||||
|
Set<String> documentIdList = new HashSet<String>();
|
||||||
|
if (directoryReader == null) {
|
||||||
|
// The directory reader is not yet initialized (probably because there is nothing indexed)
|
||||||
|
return documentIdList;
|
||||||
|
}
|
||||||
|
IndexSearcher searcher = new IndexSearcher(directoryReader);
|
||||||
TopDocs topDocs = searcher.search(query, userFilter, Integer.MAX_VALUE);
|
TopDocs topDocs = searcher.search(query, userFilter, Integer.MAX_VALUE);
|
||||||
ScoreDoc[] docs = topDocs.scoreDocs;
|
ScoreDoc[] docs = topDocs.scoreDocs;
|
||||||
|
|
||||||
// Extract document IDs
|
// Extract document IDs
|
||||||
Set<String> documentIdList = new HashSet<String>();
|
|
||||||
for (int i = 0; i < docs.length; i++) {
|
for (int i = 0; i < docs.length; i++) {
|
||||||
org.apache.lucene.document.Document document = searcher.doc(docs[i].doc);
|
org.apache.lucene.document.Document document = searcher.doc(docs[i].doc);
|
||||||
String type = document.get("type");
|
String type = document.get("type");
|
||||||
|
@ -128,7 +128,6 @@ public class IndexingService extends AbstractScheduledService {
|
|||||||
public DirectoryReader getDirectoryReader() {
|
public DirectoryReader getDirectoryReader() {
|
||||||
if (directoryReader == null) {
|
if (directoryReader == null) {
|
||||||
if (!DirectoryReader.indexExists(directory)) {
|
if (!DirectoryReader.indexExists(directory)) {
|
||||||
log.info("Lucene directory not yet created");
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
|
@ -60,7 +60,7 @@
|
|||||||
<div class="navbar" ng-controller="Navigation">
|
<div class="navbar" ng-controller="Navigation">
|
||||||
<div class="navbar-inner">
|
<div class="navbar-inner">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="brand loader" ng-class="{hide: !isLoading() }">
|
<div class="brand loader hidden-phone" ng-class="{hide: !isLoading() }">
|
||||||
<img src="img/loader.gif" />
|
<img src="img/loader.gif" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -1,4 +1,7 @@
|
|||||||
<form class="form-horizontal" name="documentForm">
|
<img src="img/loader.gif" ng-if="!document && isEdit()" />
|
||||||
|
|
||||||
|
<div ng-if="document || !isEdit()">
|
||||||
|
<form class="form-horizontal" name="documentForm">
|
||||||
<div class="control-group" ng-class="{ error: !documentForm.title.$valid }">
|
<div class="control-group" ng-class="{ error: !documentForm.title.$valid }">
|
||||||
<label class="control-label" for="inputTitle">Title</label>
|
<label class="control-label" for="inputTitle">Title</label>
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
@ -46,11 +49,12 @@
|
|||||||
<button type="submit" class="btn btn-primary" ng-disabled="!documentForm.$valid || fileIsUploading" ng-click="edit()">{{ isEdit() ? 'Edit' : 'Add' }}</button>
|
<button type="submit" class="btn btn-primary" ng-disabled="!documentForm.$valid || fileIsUploading" ng-click="edit()">{{ isEdit() ? 'Edit' : 'Add' }}</button>
|
||||||
<button type="submit" class="btn" ng-click="cancel()">Cancel</button>
|
<button type="submit" class="btn" ng-click="cancel()">Cancel</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<div class="row-fluid" ng-show="fileIsUploading">
|
<div class="row-fluid" ng-show="fileIsUploading">
|
||||||
<h4>Uploading files...</h4>
|
<h4>Uploading files...</h4>
|
||||||
<div class="span6"><progress percent="fileProgress" class="progress-info active"></progress></div>
|
<div class="span6"><progress percent="fileProgress" class="progress-info active"></progress></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<alert ng-repeat="alert in alerts" type="alert.type" close="closeAlert($index)">{{ alert.msg }}</alert>
|
<alert ng-repeat="alert in alerts" type="alert.type" close="closeAlert($index)">{{ alert.msg }}</alert>
|
||||||
|
</div>
|
@ -1,10 +1,13 @@
|
|||||||
<h2 ng-show="isEdit()">Edit
|
<img src="img/loader.gif" ng-if="!user && isEdit()" />
|
||||||
|
|
||||||
|
<div ng-if="user || !isEdit()">
|
||||||
|
<h2 ng-show="isEdit()">Edit
|
||||||
<small>"{{ user.username }}"</small>
|
<small>"{{ user.username }}"</small>
|
||||||
</h2>
|
</h2>
|
||||||
<h2 ng-show="!isEdit()">Add
|
<h2 ng-show="!isEdit()">Add
|
||||||
<small>user</small>
|
<small>user</small>
|
||||||
</h2>
|
</h2>
|
||||||
<form class="form-horizontal" name="editUserForm" novalidate>
|
<form class="form-horizontal" name="editUserForm" novalidate>
|
||||||
<div class="control-group" ng-class="{ error: !editUserForm.username.$valid, success: editUserForm.username.$valid }">
|
<div class="control-group" ng-class="{ error: !editUserForm.username.$valid, success: editUserForm.username.$valid }">
|
||||||
<label class="control-label" for="inputUsername">Username</label>
|
<label class="control-label" for="inputUsername">Username</label>
|
||||||
|
|
||||||
@ -58,5 +61,6 @@
|
|||||||
<span class="icon-trash icon-white"></span> Delete
|
<span class="icon-trash icon-white"></span> Delete
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
<alert ng-repeat="alert in alerts" type="alert.type" close="closeAlert($index)">{{ alert.msg }}</alert>
|
<alert ng-repeat="alert in alerts" type="alert.type" close="closeAlert($index)">{{ alert.msg }}</alert>
|
||||||
|
</div>
|
Loading…
Reference in New Issue
Block a user