Skip to content
Snippets Groups Projects
Commit 24087ce3 authored by srosse's avatar srosse
Browse files

OO-965: check if there is a date before building the lucene query

parent 48807993
No related branches found
No related tags found
No related merge requests found
...@@ -22,6 +22,7 @@ package org.olat.search.ui; ...@@ -22,6 +22,7 @@ package org.olat.search.ui;
import java.text.DateFormat; import java.text.DateFormat;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Properties; import java.util.Properties;
...@@ -235,10 +236,16 @@ public class AdvancedSearchInputController extends FormBasicController { ...@@ -235,10 +236,16 @@ public class AdvancedSearchInputController extends FormBasicController {
appendAnd(queries, AbstractOlatDocument.DESCRIPTION_FIELD_NAME, ":(", descriptionQuery.getValue(), ") "); appendAnd(queries, AbstractOlatDocument.DESCRIPTION_FIELD_NAME, ":(", descriptionQuery.getValue(), ") ");
} }
if (StringHelper.containsNonWhitespace(createdDate.getValue())) { if (StringHelper.containsNonWhitespace(createdDate.getValue())) {
appendAnd(queries, AbstractOlatDocument.CREATED_FIELD_NAME, ":(", format.format(createdDate.getDate()), ") "); Date creationDate = createdDate.getDate();
if(creationDate != null) {
appendAnd(queries, AbstractOlatDocument.CREATED_FIELD_NAME, ":(", format.format(creationDate), ") ");
}
} }
if (StringHelper.containsNonWhitespace(modifiedDate.getValue())) { if (StringHelper.containsNonWhitespace(modifiedDate.getValue())) {
appendAnd(queries, AbstractOlatDocument.CHANGED_FIELD_NAME, ":(", format.format(modifiedDate.getDate()), ") "); Date modificationDate = modifiedDate.getDate();
if(modificationDate != null) {
appendAnd(queries, AbstractOlatDocument.CHANGED_FIELD_NAME, ":(", format.format(modificationDate), ") ");
}
} }
//Check for null on metadata element since it might not be configured and initialized //Check for null on metadata element since it might not be configured and initialized
if (metadataQuery != null && StringHelper.containsNonWhitespace(metadataQuery.getValue())) { if (metadataQuery != null && StringHelper.containsNonWhitespace(metadataQuery.getValue())) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment