This commit is contained in:
yfujita 2014-10-22 02:48:12 +09:00
parent f38d23cece
commit 37bd1a3cd8
2 changed files with 34 additions and 36 deletions

View file

@ -402,7 +402,7 @@ public class DocumentAction implements Serializable {
final Map<String, Long> map = new HashMap<String, Long>();
map.put("content", suggestService.getContentDocumentNum());
map.put("searchLog", suggestService.getSearchLogDocumentNum());
map.put("all", map.get("content") + map.get("searchLog"));
map.put("all", suggestService.getDocumentNum());
return map;
}
@ -414,40 +414,46 @@ public class DocumentAction implements Serializable {
final String query;
if ("content".equals(documentForm.deleteSuggestType)) {
query = "*:* NOT " + SuggestConstants.SuggestFieldNames.SEGMENT
+ ":0";
+ ":" + SuggestConstants.SEGMENT_ELEVATE + " NOT "
+ SuggestConstants.SuggestFieldNames.SEGMENT + ":"
+ SuggestConstants.SEGMENT_QUERY;
} else if ("searchLog".equals(documentForm.deleteSuggestType)) {
query = SuggestConstants.SuggestFieldNames.SEGMENT + ":0";
query = SuggestConstants.SuggestFieldNames.SEGMENT + ":"
+ SuggestConstants.SEGMENT_QUERY;
} else {
query = "*:*";
query = "";
}
final Thread thread = new Thread(new Runnable() {
@Override
public void run() {
if (!jobHelper.isCrawlProcessRunning()) {
final long execTime = System.currentTimeMillis();
try {
suggestSolrServer.deleteByQuery(query);
suggestSolrServer.commit();
if (logger.isInfoEnabled()) {
logger.info("[EXEC TIME] suggest index cleanup time: "
+ (System.currentTimeMillis() - execTime)
+ "ms");
if (StringUtil.isNotBlank(query)) {
final Thread thread = new Thread(new Runnable() {
@Override
public void run() {
if (!jobHelper.isCrawlProcessRunning()) {
final long execTime = System.currentTimeMillis();
try {
suggestSolrServer.deleteByQuery(query);
suggestSolrServer.commit();
if (logger.isInfoEnabled()) {
logger.info("[EXEC TIME] suggest index cleanup time: "
+ (System.currentTimeMillis() - execTime)
+ "ms");
}
} catch (final Exception e) {
logger.error(
"Failed to delete suggest index (query="
+ query + ").", e);
}
} else {
if (logger.isInfoEnabled()) {
logger.info("could not start index cleanup process"
+ " because of running solr process.");
}
} catch (final Exception e) {
logger.error("Failed to delete suggest index (query="
+ query + ").", e);
}
} else {
if (logger.isInfoEnabled()) {
logger.info("could not start index cleanup process"
+ " because of running solr process.");
}
}
}
});
thread.start();
SAStrutsUtil.addSessionMessage("success.delete_solr_index");
});
thread.start();
SAStrutsUtil.addSessionMessage("success.delete_solr_index");
}
return showIndex(true);
}

View file

@ -158,14 +158,6 @@
<td style="vertical-align: middle;"><bean:message key="labels.suggest_type_all" /></td>
<td align="center" style="vertical-align: middle;">${suggestDocumentNums.all}</td>
<td align="center">
<s:form style="margin-bottom:0;">
<html:hidden property="deleteSuggestType"
value="all" />
<html:submit styleClass="btn" property="deleteSuggest"
disabled="${solrProcessRunning}">
<bean:message key="labels.solr_action_delete" />
</html:submit>
</s:form>
</td>
</tr>
<tr>