diff --git a/src/main/java/org/codelibs/fess/entity/SearchRequestParams.java b/src/main/java/org/codelibs/fess/entity/SearchRequestParams.java index 1bd3e0ba9c62397382a4f3204be2d8743ddad5d4..a719da3ea838b84a0c0f0b4f9ac1755ded5749ab 100644 --- a/src/main/java/org/codelibs/fess/entity/SearchRequestParams.java +++ b/src/main/java/org/codelibs/fess/entity/SearchRequestParams.java @@ -34,6 +34,8 @@ public interface SearchRequestParams { String AS_Q = "q"; + String AS_FILETYPE = "filetype"; + String getQuery(); Map getFields(); @@ -67,7 +69,8 @@ public interface SearchRequestParams { return !isEmptyArray(conditions.get(AS_Q))// || !isEmptyArray(conditions.get(AS_EPQ))// || !isEmptyArray(conditions.get(AS_OQ))// - || !isEmptyArray(conditions.get(AS_NQ)); + || !isEmptyArray(conditions.get(AS_NQ))// + || !isEmptyArray(conditions.get(AS_FILETYPE)); } public default boolean isEmptyArray(String[] values) { diff --git a/src/main/java/org/codelibs/fess/mylasta/action/FessLabels.java b/src/main/java/org/codelibs/fess/mylasta/action/FessLabels.java index 4ab4abe645b56484d9e07a1a55d7e9a9a96872b6..15dbeff44352b0ba9139e75a96115cbd3675a7c3 100644 --- a/src/main/java/org/codelibs/fess/mylasta/action/FessLabels.java +++ b/src/main/java/org/codelibs/fess/mylasta/action/FessLabels.java @@ -2685,18 +2685,39 @@ public class FessLabels extends UserMessages { /** The key of the message: Advanced Search */ public static final String LABELS_advance_search_title = "{labels.advance_search_title}"; - /** The key of the message: All these words: */ + /** The key of the message: All these words */ public static final String LABELS_advance_search_must_queries = "{labels.advance_search_must_queries}"; - /** The key of the message: This exact word or phrase: */ + /** The key of the message: This exact word or phrase */ public static final String LABELS_advance_search_phrase_query = "{labels.advance_search_phrase_query}"; - /** The key of the message: Any of these words: */ + /** The key of the message: Any of these words */ public static final String LABELS_advance_search_should_queries = "{labels.advance_search_should_queries}"; - /** The key of the message: None of these words: */ + /** The key of the message: None of these words */ public static final String LABELS_advance_search_not_queries = "{labels.advance_search_not_queries}"; + /** The key of the message: File Type */ + public static final String LABELS_advance_search_filetype = "{labels.advance_search_filetype}"; + + /** The key of the message: All Type */ + public static final String LABELS_advance_search_filetype_default = "{labels.advance_search_filetype_default}"; + + /** The key of the message: HTML */ + public static final String LABELS_advance_search_filetype_html = "{labels.advance_search_filetype_html}"; + + /** The key of the message: PDF */ + public static final String LABELS_advance_search_filetype_pdf = "{labels.advance_search_filetype_pdf}"; + + /** The key of the message: MS Word */ + public static final String LABELS_advance_search_filetype_word = "{labels.advance_search_filetype_word}"; + + /** The key of the message: MS Excel */ + public static final String LABELS_advance_search_filetype_excel = "{labels.advance_search_filetype_excel}"; + + /** The key of the message: MS PowerPoint */ + public static final String LABELS_advance_search_filetype_powerpoint = "{labels.advance_search_filetype_powerpoint}"; + /** * Assert the property is not null. * @param property The value of the property. (NotNull) diff --git a/src/main/java/org/codelibs/fess/util/QueryStringBuilder.java b/src/main/java/org/codelibs/fess/util/QueryStringBuilder.java index 10e2e72672ee92a8d41ea6a5fd266067ef01b8cf..a49b8731d14ee540f11c0c5de24ba1e9a1ceeb15 100644 --- a/src/main/java/org/codelibs/fess/util/QueryStringBuilder.java +++ b/src/main/java/org/codelibs/fess/util/QueryStringBuilder.java @@ -124,6 +124,9 @@ public class QueryStringBuilder { s -> s.filter(StringUtil::isNotBlank).map(q -> "NOT " + q).collect(Collectors.joining(" "))); queryBuf.append(' ').append(nq); })); + stream(conditions.get(SearchRequestParams.AS_FILETYPE)).of( + stream -> stream.filter(q -> StringUtil.isNotBlank(q) && q.length() <= maxQueryLength).forEach( + q -> queryBuf.append(" filetype:\"").append(q.trim()).append('"'))); } diff --git a/src/main/resources/fess_label.properties b/src/main/resources/fess_label.properties index 910828521b50697c6588d57539c20384964c7df6..6a091596decd489abfe3d6cdef940e5dc251deb6 100644 --- a/src/main/resources/fess_label.properties +++ b/src/main/resources/fess_label.properties @@ -889,3 +889,10 @@ labels.advance_search_must_queries=All these words labels.advance_search_phrase_query=This exact word or phrase labels.advance_search_should_queries=Any of these words labels.advance_search_not_queries=None of these words +labels.advance_search_filetype=File Type +labels.advance_search_filetype_default=All Type +labels.advance_search_filetype_html=HTML +labels.advance_search_filetype_pdf=PDF +labels.advance_search_filetype_word=MS Word +labels.advance_search_filetype_excel=MS Excel +labels.advance_search_filetype_powerpoint=MS PowerPoint diff --git a/src/main/resources/fess_label_en.properties b/src/main/resources/fess_label_en.properties index 5656fd6c65012f2d33104eb9ca1f8159521edcba..f58f851f235420b21bd53ca9fbdd789f311ffa83 100644 --- a/src/main/resources/fess_label_en.properties +++ b/src/main/resources/fess_label_en.properties @@ -889,3 +889,10 @@ labels.advance_search_must_queries=All these words labels.advance_search_phrase_query=This exact word or phrase labels.advance_search_should_queries=Any of these words labels.advance_search_not_queries=None of these words +labels.advance_search_filetype=File Type +labels.advance_search_filetype_default=All Type +labels.advance_search_filetype_html=HTML +labels.advance_search_filetype_pdf=PDF +labels.advance_search_filetype_word=MS Word +labels.advance_search_filetype_excel=MS Excel +labels.advance_search_filetype_powerpoint=MS PowerPoint diff --git a/src/main/resources/fess_label_ja.properties b/src/main/resources/fess_label_ja.properties index f69a2abcf6cbabc0c11032636b60eccc18aea0ec..af13c9511b575cb726e9b0c7edfaf808d89db8c7 100644 --- a/src/main/resources/fess_label_ja.properties +++ b/src/main/resources/fess_label_ja.properties @@ -891,3 +891,10 @@ labels.advance_search_must_queries=\u3059\u3079\u3066\u306e\u5358\u8a9e\u3092\u5 labels.advance_search_phrase_query=\u8a9e\u9806\u3082\u542b\u3081\u305f\u5b8c\u5168\u4e00\u81f4 labels.advance_search_should_queries=\u3044\u305a\u308c\u304b\u306e\u5358\u8a9e\u3092\u542b\u3080 labels.advance_search_not_queries=\u542b\u3081\u306a\u3044\u5358\u8a9e +labels.advance_search_filetype=\u30d5\u30a1\u30a4\u30eb\u5f62\u5f0f +labels.advance_search_filetype_default=\u3059\u3079\u3066\u306e\u5f62\u5f0f +labels.advance_search_filetype_html=HTML +labels.advance_search_filetype_pdf=PDF +labels.advance_search_filetype_word=MS Word +labels.advance_search_filetype_excel=MS Excel +labels.advance_search_filetype_powerpoint=MS PowerPoint diff --git a/src/main/webapp/WEB-INF/view/advance.jsp b/src/main/webapp/WEB-INF/view/advance.jsp index df90a336fb25dcc53978f6b0d6298bd4895dee82..8da7b4fcb7a30ffc0c361cc51cf81f74f4333c2b 100644 --- a/src/main/webapp/WEB-INF/view/advance.jsp +++ b/src/main/webapp/WEB-INF/view/advance.jsp @@ -233,6 +233,34 @@ +
+ +
+ +
+
+ +
+