mirror of
https://github.com/sismics/docs.git
synced 2024-11-22 22:07:56 +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,3 +1,6 @@
|
|||||||
|
<img src="img/loader.gif" ng-if="!document && isEdit()" />
|
||||||
|
|
||||||
|
<div ng-if="document || !isEdit()">
|
||||||
<form class="form-horizontal" name="documentForm">
|
<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>
|
||||||
@ -54,3 +57,4 @@
|
|||||||
</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,3 +1,6 @@
|
|||||||
|
<img src="img/loader.gif" ng-if="!user && isEdit()" />
|
||||||
|
|
||||||
|
<div ng-if="user || !isEdit()">
|
||||||
<h2 ng-show="isEdit()">Edit
|
<h2 ng-show="isEdit()">Edit
|
||||||
<small>"{{ user.username }}"</small>
|
<small>"{{ user.username }}"</small>
|
||||||
</h2>
|
</h2>
|
||||||
@ -60,3 +63,4 @@
|
|||||||
</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