Hello All,
We are adding a new Filter fields for Coremetadata (Available Date,Refrenece date) for filtering the content based on available and refrence date in dcoument search in CMS.
I have created a new custiomezed plugin class for Date. But Result are not filerting if doing the search for CoreMetadata field but same Plugin is working fine If we do the search for Document Date field.
I have gone through the document but not found a example for Compound fields search.
Can anyone pls suggest how to get the Coremetadata fields for below code snippet.
Here are the code snappnet i was trying:
List constraints = new LinkedList();
List constraints = new LinkedList();
addDateConstraints(constraints, “myproject:CoreMetadata\myproject:date_available”, availableDateFrom, availableDateTo); – Not giving any result tried with “ftcore:date_available”)
List constraints = new LinkedList();
addDateConstraints(constraints, “myproject:CoreMetadata\myproject:date”, DateFrom, DateTo); - Working the for Document field.
Code:
@Override
public List<Constraint> getConstraints() {
List<Constraint> constraints = new LinkedList();
addDateConstraints(constraints, “myproject:CoreMetadata\myproject:date_available”, availableDateFrom, availableDateTo);
addDateConstraints(constraints, "myproject:CoreMetadata\myproject:date__reference", visibleReferenceFrom, visibleReferenceTo);
return constraints;
}
private void addDateConstraints(final List<Constraint> constraints, final String property, final Date dateAfter,
final Date dateBefore) {
if (dateAfter != null) {
final LowerBoundedDateConstraint constraint = QueryUtils.date(property).from(dateAfter);
constraints.add(constraint);
if (dateBefore != null) {
constraint.andTo(dateBefore);
}
} else if (dateBefore != null) {
constraints.add(QueryUtils.date(property).to(dateBefore));
}
}
Thanks in advance for your help.