?? searchsettings.jsp
字號:
<%-- - - $RCSfile: searchSettings.jsp,v $ - $Revision: 1.1.2.4 $ - $Date: 2003/07/28 15:45:39 $ ---%><%@ page import="java.util.*, java.text.*, com.jivesoftware.forum.*, com.jivesoftware.forum.database.*, com.jivesoftware.forum.util.*, java.io.File, com.jivesoftware.util.*, com.jivesoftware.base.JiveGlobals, com.jivesoftware.base.UnauthorizedException" errorPage="error.jsp"%><%@ include file="global.jsp" %><%! // Global vars, methods, etc // Types of search indexers static final String[][] INDEXERS = { { "com.jivesoftware.util.search.StandardSynonymAnalyzer", "English (Standard, Non-stemming)" }, { "com.jivesoftware.util.search.CJKAnalyzer", "Chinese, Japanese and Korean" }, { "com.jivesoftware.util.search.DanishStemmingAnalyzer", "Danish *" }, { "com.jivesoftware.util.search.DutchStemmingAnalyzer", "Dutch *" }, { "com.jivesoftware.util.search.EnglishStemmingAnalyzer", "English *" }, { "com.jivesoftware.util.search.FinnishStemmingAnalyzer", "Finnish *" }, { "com.jivesoftware.util.search.FrenchStemmingAnalyzer", "French *" }, { "com.jivesoftware.util.search.GermanStemmingAnalyzer", "German *" }, { "com.jivesoftware.util.search.ItalianStemmingAnalyzer", "Italian *" }, { "com.jivesoftware.util.search.NorwegianStemmingAnalyzer", "Norwegian *" }, { "com.jivesoftware.util.search.PortugueseStemmingAnalyzer", "Portuguese *" }, { "com.jivesoftware.util.search.RussianStemmingAnalyzer", "Russian *" }, { "com.jivesoftware.util.search.SpanishStemmingAnalyzer", "Spanish *" }, { "com.jivesoftware.util.search.SwedishStemmingAnalyzer", "Swedish *" } };%><% // Permission check if (!isSystemAdmin) { throw new UnauthorizedException("You don't have admin privileges to perform this operation."); } // get parameters boolean searchEnabled = ParamUtils.getBooleanParameter(request,"searchEnabled"); boolean setSearchEnabled = ParamUtils.getBooleanParameter(request,"setSearchEnabled"); boolean saveSettings = ParamUtils.getBooleanParameter(request,"saveSettings"); boolean autoIndexEnabled = ParamUtils.getBooleanParameter(request,"autoIndexEnabled"); boolean wildcardIgnored = ParamUtils.getBooleanParameter(request,"wildcardIgnored"); boolean groupByThread = ParamUtils.getBooleanParameter(request,"groupByThread"); boolean attachmentSearchEnabled = ParamUtils.getBooleanParameter(request,"attachmentSearchEnabled"); int updateInterval = ParamUtils.getIntParameter(request,"updateInterval",5); boolean doUpdateIndex = ParamUtils.getBooleanParameter(request,"doUpdateIndex"); boolean doRebuildIndex = ParamUtils.getBooleanParameter(request,"doRebuildIndex"); boolean doOptimizeIndex = ParamUtils.getBooleanParameter(request,"doOptimizeIndex"); boolean isOptimizing = ParamUtils.getBooleanParameter(request,"isOptimizing"); String indexType = ParamUtils.getParameter(request,"indexType"); if (indexType == null) { indexType = JiveGlobals.getJiveProperty("search.analyzer.className"); if (indexType == null) { indexType = "com.jivesoftware.util.search.StandardSynonymAnalyzer"; } } // Get the search manager SearchManager searchManager = forumFactory.getSearchManager(); // enable or disable search if (setSearchEnabled) { searchManager.setSearchEnabled(searchEnabled); response.sendRedirect("searchSettings.jsp"); return; } // Alter search settings if (saveSettings) { // auto indexing searchManager.setAutoIndexEnabled(autoIndexEnabled); // index interval searchManager.setAutoIndexInterval(updateInterval); // indexer type DbSearchManager.setAnalyzer(indexType); // wildcards searchManager.setWildcardIgnored(wildcardIgnored); // group results by thread: if (groupByThread) { JiveGlobals.setJiveProperty("search.results.groupByThread","true"); } else { JiveGlobals.setJiveProperty("search.results.groupByThread","false"); } // attachment search searchManager.setAttachmentSearchEnabled(attachmentSearchEnabled); // All done, so redirect and indicate success: response.sendRedirect("searchSettings.jsp?success=true"); } // update index if requested if (doUpdateIndex) { searchManager.updateIndex(); // wait 1 second before returning to give the search indexer a chance to start: try { Thread.sleep(1000L); } catch (InterruptedException ignored) {} response.sendRedirect("searchSettings.jsp"); return; } // rebuild index if requested if (doRebuildIndex) { searchManager.rebuildIndex(); // wait 1 second before returning to give the search indexer a chance to start: try { Thread.sleep(1000L); } catch (InterruptedException ignored) {} response.sendRedirect("searchSettings.jsp"); return; } if (doOptimizeIndex) { searchManager.optimize(); // wait 1 second before returning to give the search indexer a chance to start: try { Thread.sleep(1000L); } catch (InterruptedException ignored) {} response.sendRedirect("searchSettings.jsp?isOptimizing=true"); return; } wildcardIgnored = searchManager.isWildcardIgnored(); autoIndexEnabled = searchManager.isAutoIndexEnabled(); searchEnabled = searchManager.isSearchEnabled(); updateInterval = searchManager.getAutoIndexInterval(); groupByThread = "true".equals(JiveGlobals.getJiveProperty("search.results.groupByThread")); attachmentSearchEnabled = searchManager.isAttachmentSearchEnabled();%><%@ include file="header.jsp" %><% // Title of this page and breadcrumbs String title = "Search Settings"; String[][] breadcrumbs = { {"Main", "main.jsp"}, {"Search Settings", "searchSettings.jsp"} };%><%@ include file="title.jsp" %><% // If we're doing any indexing operation, display a message if (searchManager.isBusy()) {%> <% if (isOptimizing) { %> <script language="JavaScript" type="text/javascript"> function reloadPage() { location.href='searchSettings.jsp?isOptimizing=true'; } setTimeout(reloadPage,4000); </script> <p><b>Optimizing...</b></p> <ul> Jive Forums is currently optimizing the search index. This may take a few moments.... </ul> <% } else { %> <script language="JavaScript" type="text/javascript"> function reloadPage() { location.href='searchSettings.jsp?isIndexing=true'; } setTimeout(reloadPage,4000); </script> <p><b>Indexing...</b></p> <ul> <b><%= searchManager.getPercentComplete() %>% complete.</b> <% if (searchManager.getTotalCount() != -1) { %> Documents indexed: <%= LocaleUtils.getLocalizedNumber(searchManager.getCurrentCount(), JiveGlobals.getLocale()) %>, total documents: <%= LocaleUtils.getLocalizedNumber(searchManager.getTotalCount(), JiveGlobals.getLocale()) %>. <p> Jive Forums is currently updating or rebuilding the search index. This may take a few moments.... <% } %> </p> </ul> <% } %><% } else { // Else, if the search manager is not busy, show search settings:%> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td> <b>Search Status</b> </td> <td> <a href="#" onclick="helpwin('search','search_status');return false;" title="Click for help" ><img src="images/help-16x16.gif" width="16" height="16" border="0" hspace="8"></a> </td> </tr> </table> <ul> <p> Turn the search feature on or off: </p> <form action="searchSettings.jsp"> <input type="hidden" name="setSearchEnabled" value="true"> <table bgcolor="<%= tblBorderColor %>" cellpadding="0" cellspacing="0" border="0" width="300"> <tr><td> <table bgcolor="<%= tblBorderColor %>" cellpadding="3" cellspacing="1" border="0" width="100%"> <tr bgcolor="#ffffff"> <td align="center"<%= (searchEnabled)?" bgcolor=\"#99cc99\"":"" %>> <input type="radio" name="searchEnabled" value="true" id="rb01" <%= (searchEnabled)?"checked":"" %>> <label for="rb01"><%= (searchEnabled)?"<b>On</b>":"On" %></label> </td> <td align="center"<%= (!searchEnabled)?" bgcolor=\"#cc6666\"":"" %>> <input type="radio" name="searchEnabled" value="false" id="rb02" <%= (!searchEnabled)?"checked":"" %>> <label for="rb02"><%= (!searchEnabled)?"<b>Off</b>":"Off" %></label> </td> <td align="center"> <input type="submit" value="Update"> </td> </tr> </table> </td></tr> </table> </form> <% // Show index info if search is enabled if (searchEnabled) { // Compute the size of the index: double size = 0; DecimalFormat megFormatter = new DecimalFormat("#,##0.00"); File searchHome = new File(JiveGlobals.getJiveHome() + File.separator + "search" + File.separator + JiveGlobals.getJiveProperty("search.directory"));
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -