Index: grails-app/controllers/com/lemans/ds/solr/DsSolrQueueController.groovy =================================================================== diff -u -rcf234013798bafcf4cc198acbd082af71f6706aa -r34a464a7156390bcd38ebeb4130545f1d2368582 --- grails-app/controllers/com/lemans/ds/solr/DsSolrQueueController.groovy (.../DsSolrQueueController.groovy) (revision cf234013798bafcf4cc198acbd082af71f6706aa) +++ grails-app/controllers/com/lemans/ds/solr/DsSolrQueueController.groovy (.../DsSolrQueueController.groovy) (revision 34a464a7156390bcd38ebeb4130545f1d2368582) @@ -1,6 +1,7 @@ package com.lemans.ds.solr import com.lemans.LemansApiController +import groovy.json.JsonSlurper import groovy.time.TimeCategory import org.springframework.scheduling.support.CronSequenceGenerator @@ -50,11 +51,21 @@ vendorId: params.list('vendorId'), brandId: params.list('brandId'), userName: params.list('userName'), - derivedPartStatusId: params.list('derivedPartStatusId') + derivedPartStatusId: params.list('derivedPartStatusId'), + goliveDate: dateRangeList() ]) ] ) } + + private List dateRangeList() { + JsonSlurper jsonSlurper = new JsonSlurper() + params.list('goliveDateRange').collect { + DateRange goLiveDateRange = new DateRange() + bindData(goLiveDateRange, jsonSlurper.parseText(it)) + goLiveDateRange + } + } } class QueuePayload { @@ -69,8 +80,14 @@ List brandId List derivedPartStatusId List userName + List goliveDate } +class DateRange { + Date start + Date end +} + enum QueueType { PARTS_WITH_OUT_CATEGORY('Parts With Out Category', QueueMode.PART), PARTS_WITH_OUT_ATTRIBUTE_VALUE('Parts With Out Attribute Value', QueueMode.PART), Index: grails-app/services/com/lemans/ds/solr/SolrQueryService.groovy =================================================================== diff -u -r72147c58cbdd306930e13386da657930749ea06a -r34a464a7156390bcd38ebeb4130545f1d2368582 --- grails-app/services/com/lemans/ds/solr/SolrQueryService.groovy (.../SolrQueryService.groovy) (revision 72147c58cbdd306930e13386da657930749ea06a) +++ grails-app/services/com/lemans/ds/solr/SolrQueryService.groovy (.../SolrQueryService.groovy) (revision 34a464a7156390bcd38ebeb4130545f1d2368582) @@ -21,7 +21,9 @@ private static final List VALID_FQ_FIELDS = ['categoryId', 'brandId', 'vendorId', 'derivedPartStatusId', 'userName'] + private static final List VALID_FQ_DATE_FIELDS = ['goliveDate'] + private static final String QUEUE_COUNT = 'SELECT * FROM [QueueWeeklyCountHistory] WHERE weekEndDate = ? AND dateDeleted IS NULL' def dsQueueSolrClient @@ -533,6 +535,13 @@ query.addFilterQuery("(${it}:(${ids.join(' OR ')}))") } } + + VALID_FQ_DATE_FIELDS.each { + List dateRanges = payload.filters?.getProperty(it) + if (dateRanges) { + query.addFilterQuery("(${it}:(${dateRanges.collect { "[${it.start.toInstant().toString()} TO ${it.end.toInstant().toString()}]" }.join(' OR ')}))") + } + } } private SolrQuery buildCardinalityQuery(SolrQuery query, QueuePayload payload) {