Skip to content

Commit

Permalink
Merge branch 'master' into target-environment
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelwechner committed Jan 25, 2012
2 parents 6f38ff3 + 6a04a31 commit b45ff8a
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 10 deletions.
38 changes: 34 additions & 4 deletions src/contributions/resources/search/htdocs/reindexer.xsl
Expand Up @@ -20,12 +20,42 @@
<xsl:if test="not(y:exception or y:message)">
-->
<p>Choose which repository you would like to re-index:</p>
<ul>

<!--
<p>
DEBUG: Selected repository ID: <xsl:value-of select="y:selected-repository/@id"/>
</p>
-->

<p>

<!-- For example: ...?repository=yanel_data&path=/projects/where-have-all-the-rabbits-gone/footage -->
<form method="get">
<select name="repository">
<xsl:for-each select="y:repository">
<li>
<a href="?repository={@id}"><xsl:value-of select="."/></a></li>
<xsl:choose>
<xsl:when test="../y:selected-repository and ../y:selected-repository/@id = @id">
<option value="{@id}" selected="selected"><xsl:value-of select="."/></option>
</xsl:when>
<xsl:otherwise>
<option value="{@id}"><xsl:value-of select="."/></option>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</ul>
</select>
<br/>
<xsl:choose>
<xsl:when test="y:selected-path">
Path: <input type="text" name="path" value="{y:selected-path}"/>
</xsl:when>
<xsl:otherwise>
Path: <input type="text" name="path" value="/"/>
</xsl:otherwise>
</xsl:choose>
<br/>
<input type="submit" value="Re-Index"/>
</form>
</p>
<!--
</xsl:if>
-->
Expand Down
Expand Up @@ -92,15 +92,18 @@ protected InputStream getContentXML(String viewId) throws Exception {
if(repo != null) {
YarepUtil yu = new YarepUtil();

String path = "/";
if (getEnvironment().getRequest().getParameter("path") != null) {
path = getEnvironment().getRequest().getParameter("path"); // INFO: Allows to re-index sub-tree, for example http://127.0.0.1:8080/yanel/yanel-website/re-index.html?repository=yanel_data&path=/en/documentation
}

try {
String path = "/";
if (getEnvironment().getRequest().getParameter("path") != null) {
path = getEnvironment().getRequest().getParameter("path"); // INFO: Allows to re-index sub-tree, for example http://127.0.0.1:8080/yanel/yanel-website/re-index.html?repository=yanel_data&path=/en/documentation
}
yu.indexRepository(repo, path);
sb.append("<r:message>Re-indexing was successful.</r:message>");
sb.append("<r:message>Re-indexing of repository '" + repo.getName() + "' starting at path '" + path + "' was successful :-)</r:message>");
sb.append("<r:selected-repository id=\"" + reindexRepo + "\">" + repo.getName() + "</r:selected-repository>");
sb.append("<r:selected-path>" + path + "</r:selected-path>");
} catch(Exception e) {
sb.append("<r:exception>Re-indexing failed with exception: ");
sb.append("<r:exception>Re-indexing of repository '" + repo.getName() + "' starting at path '" + path + "' failed with exception: ");
sb.append(e.getMessage());
sb.append("</r:exception>");
}
Expand Down

0 comments on commit b45ff8a

Please sign in to comment.