fix #1548 add timestamp
This commit is contained in:
parent
5e00081128
commit
711e71ea0d
7 changed files with 112 additions and 43 deletions
|
@ -40,6 +40,8 @@ public interface SearchRequestParams {
|
|||
|
||||
String AS_OCCURRENCE = "occt";
|
||||
|
||||
String AS_TIMESTAMP = "timestamp";
|
||||
|
||||
String getQuery();
|
||||
|
||||
Map<String, String[]> getFields();
|
||||
|
@ -74,6 +76,7 @@ public interface SearchRequestParams {
|
|||
|| !isEmptyArray(conditions.get(AS_EPQ))//
|
||||
|| !isEmptyArray(conditions.get(AS_OQ))//
|
||||
|| !isEmptyArray(conditions.get(AS_NQ))//
|
||||
|| !isEmptyArray(conditions.get(AS_TIMESTAMP))//
|
||||
|| !isEmptyArray(conditions.get(AS_SITESEARCH))//
|
||||
|| !isEmptyArray(conditions.get(AS_FILETYPE));
|
||||
}
|
||||
|
|
|
@ -2733,6 +2733,24 @@ public class FessLabels extends UserMessages {
|
|||
/** The key of the message: Site or domain */
|
||||
public static final String LABELS_advance_search_sitesearch = "{labels.advance_search_sitesearch}";
|
||||
|
||||
/** The key of the message: Last update */
|
||||
public static final String LABELS_advance_search_timestamp = "{labels.advance_search_timestamp}";
|
||||
|
||||
/** The key of the message: anytime */
|
||||
public static final String LABELS_advance_search_timestamp_default = "{labels.advance_search_timestamp_default}";
|
||||
|
||||
/** The key of the message: past 24 hours */
|
||||
public static final String LABELS_advance_search_timestamp_pastday = "{labels.advance_search_timestamp_pastday}";
|
||||
|
||||
/** The key of the message: past week */
|
||||
public static final String LABELS_advance_search_timestamp_pastweek = "{labels.advance_search_timestamp_pastweek}";
|
||||
|
||||
/** The key of the message: past month */
|
||||
public static final String LABELS_advance_search_timestamp_pastmonth = "{labels.advance_search_timestamp_pastmonth}";
|
||||
|
||||
/** The key of the message: past year */
|
||||
public static final String LABELS_advance_search_timestamp_pastyear = "{labels.advance_search_timestamp_pastyear}";
|
||||
|
||||
/**
|
||||
* Assert the property is not null.
|
||||
* @param property The value of the property. (NotNull)
|
||||
|
|
|
@ -133,6 +133,9 @@ public class QueryStringBuilder {
|
|||
stream(conditions.get(SearchRequestParams.AS_SITESEARCH)).of(
|
||||
stream -> stream.filter(q -> StringUtil.isNotBlank(q) && q.length() <= maxQueryLength).forEach(
|
||||
q -> queryBuf.append(" site:").append(q.trim())));
|
||||
stream(conditions.get(SearchRequestParams.AS_TIMESTAMP)).of(
|
||||
stream -> stream.filter(q -> StringUtil.isNotBlank(q) && q.length() <= maxQueryLength).forEach(
|
||||
q -> queryBuf.append(" timestamp:").append(q.trim())));
|
||||
}
|
||||
|
||||
protected boolean isOccurrence(final String value) {
|
||||
|
|
|
@ -901,3 +901,9 @@ labels.advance_search_occt_default=anywhere in the page
|
|||
labels.advance_search_occt_allintitle=in the title of the page
|
||||
labels.advance_search_occt_allinurl=in the url of the page
|
||||
labels.advance_search_sitesearch=Site or domain
|
||||
labels.advance_search_timestamp=Last update
|
||||
labels.advance_search_timestamp_default=anytime
|
||||
labels.advance_search_timestamp_pastday=past 24 hours
|
||||
labels.advance_search_timestamp_pastweek=past week
|
||||
labels.advance_search_timestamp_pastmonth=past month
|
||||
labels.advance_search_timestamp_pastyear=past year
|
||||
|
|
|
@ -901,3 +901,9 @@ labels.advance_search_occt_default=anywhere in the page
|
|||
labels.advance_search_occt_allintitle=in the title of the page
|
||||
labels.advance_search_occt_allinurl=in the url of the page
|
||||
labels.advance_search_sitesearch=Site or domain
|
||||
labels.advance_search_timestamp=Last update
|
||||
labels.advance_search_timestamp_default=anytime
|
||||
labels.advance_search_timestamp_pastday=past 24 hours
|
||||
labels.advance_search_timestamp_pastweek=past week
|
||||
labels.advance_search_timestamp_pastmonth=past month
|
||||
labels.advance_search_timestamp_pastyear=past year
|
||||
|
|
|
@ -903,3 +903,9 @@ labels.advance_search_occt_default=\u30da\u30fc\u30b8\u5168\u4f53
|
|||
labels.advance_search_occt_allintitle=\u30da\u30fc\u30b8\u5185\u306e\u30bf\u30a4\u30c8\u30eb
|
||||
labels.advance_search_occt_allinurl=\u30da\u30fc\u30b8\u5185\u306eURL
|
||||
labels.advance_search_sitesearch=\u30b5\u30a4\u30c8\u307e\u305f\u306f\u30c9\u30e1\u30a4\u30f3
|
||||
labels.advance_search_timestamp=\u66f4\u65b0\u65e5\u6642
|
||||
labels.advance_search_timestamp_default=\u6307\u5b9a\u306a\u3057
|
||||
labels.advance_search_timestamp_pastday=24\u6642\u9593\u4ee5\u5185
|
||||
labels.advance_search_timestamp_pastweek=1\u9031\u9593\u4ee5\u5185
|
||||
labels.advance_search_timestamp_pastmonth=1\u30f6\u6708\u4ee5\u5185
|
||||
labels.advance_search_timestamp_pastyear=1\u5e74\u4ee5\u5185
|
||||
|
|
|
@ -19,51 +19,53 @@
|
|||
<la:form styleClass="form-stacked" action="/search/" method="get" styleId="searchForm">
|
||||
${fe:facetForm()}${fe:geoForm()}
|
||||
<nav class="navbar navbar-dark bg-inverse navbar-static-top pos-f-t">
|
||||
<div id="content" class="container">
|
||||
<ul class="nav navbar-nav pull-right">
|
||||
<c:choose>
|
||||
<c:when test="${!empty username && username != 'guest'}">
|
||||
<li class="nav-item">
|
||||
<div class="dropdown">
|
||||
<a class="nav-link dropdown-toggle" data-toggle="dropdown" href="#" role="button" aria-haspopup="true"
|
||||
aria-expanded="false"
|
||||
> <i class="fa fa-user"></i>${username}
|
||||
</a>
|
||||
<div class="dropdown-menu" aria-labelledby="userMenu">
|
||||
<c:if test="${editableUser == true}">
|
||||
<la:link href="/profile" styleClass="dropdown-item">
|
||||
<la:message key="labels.profile" />
|
||||
</la:link>
|
||||
</c:if>
|
||||
<c:if test="${adminUser == true}">
|
||||
<la:link href="/admin" styleClass="dropdown-item">
|
||||
<la:message key="labels.administration" />
|
||||
</la:link>
|
||||
</c:if>
|
||||
<la:link href="/logout/" styleClass="dropdown-item">
|
||||
<la:message key="labels.logout" />
|
||||
<la:link styleClass="navbar-brand" href="/">
|
||||
<img src="${fe:url('/images/logo-head.png')}"
|
||||
alt="<la:message key="labels.header_brand_name" />" />
|
||||
</la:link>
|
||||
<ul class="nav navbar-nav pull-right">
|
||||
<c:choose>
|
||||
<c:when test="${!empty username && username != 'guest'}">
|
||||
<li class="nav-item">
|
||||
<div class="dropdown">
|
||||
<a class="nav-link dropdown-toggle" data-toggle="dropdown" href="#" role="button" aria-haspopup="true"
|
||||
aria-expanded="false"
|
||||
> <i class="fa fa-user"></i>${username}
|
||||
</a>
|
||||
<div class="dropdown-menu" aria-labelledby="userMenu">
|
||||
<c:if test="${editableUser == true}">
|
||||
<la:link href="/profile" styleClass="dropdown-item">
|
||||
<la:message key="labels.profile" />
|
||||
</la:link>
|
||||
</div>
|
||||
</c:if>
|
||||
<c:if test="${adminUser == true}">
|
||||
<la:link href="/admin" styleClass="dropdown-item">
|
||||
<la:message key="labels.administration" />
|
||||
</la:link>
|
||||
</c:if>
|
||||
<la:link href="/logout/" styleClass="dropdown-item">
|
||||
<la:message key="labels.logout" />
|
||||
</la:link>
|
||||
</div>
|
||||
</li>
|
||||
</c:when>
|
||||
<c:when test="${ pageLoginLink }">
|
||||
<li class="nav-item username"><la:link href="/login" styleClass="nav-link" role="button"
|
||||
aria-haspopup="true" aria-expanded="false"
|
||||
>
|
||||
<i class="fa fa-sign-in"></i>
|
||||
<la:message key="labels.login" />
|
||||
</la:link></li>
|
||||
</c:when>
|
||||
</c:choose>
|
||||
<li class="nav-item"><la:link href="/help" styleClass="nav-link help-link">
|
||||
<i class="fa fa-question-circle"></i>
|
||||
<la:message key="labels.index_help" />
|
||||
</la:link></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
</c:when>
|
||||
<c:when test="${ pageLoginLink }">
|
||||
<li class="nav-item username"><la:link href="/login" styleClass="nav-link" role="button" aria-haspopup="true"
|
||||
aria-expanded="false"
|
||||
>
|
||||
<i class="fa fa-sign-in"></i>
|
||||
<la:message key="labels.login" />
|
||||
</la:link></li>
|
||||
</c:when>
|
||||
</c:choose>
|
||||
<li class="nav-item"><la:link href="/help" styleClass="nav-link help-link">
|
||||
<i class="fa fa-question-circle"></i>
|
||||
<la:message key="labels.index_help" />
|
||||
</la:link></li>
|
||||
</ul>
|
||||
</nav>
|
||||
<div class="container">
|
||||
<div id="content" class="container">
|
||||
<div class="row content">
|
||||
<div class="center-block">
|
||||
<h2>
|
||||
|
@ -233,6 +235,31 @@
|
|||
</div>
|
||||
</div>
|
||||
</c:if>
|
||||
<div class="form-group row">
|
||||
<label for="as_timestamp" class="col-lg-3 col-md-4 col-sm-5 col-xs-6 col-form-label"><la:message
|
||||
key="labels.advance_search_timestamp"
|
||||
/></label>
|
||||
<div class="col-lg-5 col-md-8 col-sm-7 col-xs-6">
|
||||
<select id="as_timestamp" name="as.timestamp" class="form-control">
|
||||
<option value=""><la:message key="labels.advance_search_timestamp_default" /></option>
|
||||
<option value="[now-1d/d TO *]"
|
||||
<c:if test="${as.timestamp.contains('[now-1d/d TO *]')}">selected</c:if>
|
||||
><la:message key="labels.advance_search_timestamp_pastday" /></option>
|
||||
<option value="[now-1w/d TO *]"
|
||||
<c:if test="${as.timestamp.contains('[now-1w/d TO *]')}">selected</c:if>
|
||||
><la:message key="labels.advance_search_timestamp_pastweek" /></option>
|
||||
<option value="[now-1M/d TO *]"
|
||||
<c:if test="${as.timestamp.contains('[now-1M/d TO *]')}">selected</c:if>
|
||||
><la:message key="labels.advance_search_timestamp_pastmonth" /></option>
|
||||
<option value="[now-1y/d TO *]"
|
||||
<c:if test="${as.timestamp.contains('[now-1y/d TO *]')}">selected</c:if>
|
||||
><la:message key="labels.advance_search_timestamp_pastyear" /></option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-lg-4 hidden-md-down">
|
||||
<!-- TODO -->
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label for="as_filetype" class="col-lg-3 col-md-4 col-sm-5 col-xs-6 col-form-label"><la:message
|
||||
key="labels.advance_search_filetype"
|
||||
|
@ -262,7 +289,7 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label for="as_filetype" class="col-lg-3 col-md-4 col-sm-5 col-xs-6 col-form-label"><la:message
|
||||
<label for="as_occt" class="col-lg-3 col-md-4 col-sm-5 col-xs-6 col-form-label"><la:message
|
||||
key="labels.advance_search_occt"
|
||||
/></label>
|
||||
<div class="col-lg-5 col-md-8 col-sm-7 col-xs-6">
|
||||
|
|
Loading…
Add table
Reference in a new issue