Skip to content

Commit

Permalink
XWIKI-7321: The "empty index" option on the main wiki Administration:…
Browse files Browse the repository at this point in the history
… Search does not work for a list of wikis

Fixed.
  • Loading branch information
sdumitriu committed Dec 26, 2011
1 parent dcff00d commit 9eac6f1
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/main/java/com/xpn/xwiki/plugin/lucene/IndexRebuilder.java
Expand Up @@ -26,6 +26,7 @@
import java.util.List;

import org.apache.commons.lang3.StringUtils;
import org.apache.lucene.index.IndexWriter;
import org.apache.lucene.index.Term;
import org.apache.lucene.search.BooleanClause;
import org.apache.lucene.search.BooleanQuery;
Expand Down Expand Up @@ -145,7 +146,14 @@ public synchronized int startIndex(Collection<String> wikis, String hqlFilter, b
if (wikis == null) {
this.indexUpdater.cleanIndex();
} else {
// TODO: clean wikis listed in wikis
try {
IndexWriter writer = this.indexUpdater.openWriter(false);
for (String wiki : wikis) {
writer.deleteDocuments(new Term(IndexFields.DOCUMENT_WIKI, wiki));
}
} catch (IOException ex) {
LOGGER.warn("Failed to clean wiki index: {}", ex.getMessage());
}
}
}

Expand Down

0 comments on commit 9eac6f1

Please sign in to comment.