     operationHelper = new OperationHelper config
   return operationHelper
 
-search = (msg, operationHelper, query, isKindle, during, page) ->
+search = (msg, operationHelper, query, isKindle, month, page) ->
 
   binding = if isKindle then 'kindle' else 'not kindle'
 
   operationHelper.execute('ItemSearch',{
     'SearchIndex': 'Books',
     'BrowseNode': comicNode,
-    'Title': query,
-#    'Power':"pubdate:#{during} and binding:#{binding}",
-    'Power':"pubdate:during 08-2016 or pubdate:during 07-2016 and binding:#{binding}",
+    'Power':"title-begins:#{query} and pubdate:after #{month} and binding:#{binding}",
     'ResponseGroup':'Large',
     'Sort':'daterank',
     'ItemPage': page


newReleaseSearch = (msg,isKindle) ->
  query = msg.match[1]
  lastMonth = moment().add(-1,'M').format('MM-YYYY')
  thisMonth = moment().format('MM-YYYY')
  nextMonth = moment().add(1,'M').format('MM-YYYY')
  during = "(during #{lastMonth} or during #{thisMonth} or during #{nextMonth})"

  operationHelper = getOperationHelper()
  search msg, operationHelper, query, isKindle ,during, 1

module.exports = (robot) ->


#   hubot scripts for amazon-product-api hubot
#
# Commands:
#   hubot kindle最新刊 <title> - kindle 版の最新刊を検索して表示
#   hubot comic最新刊 <title> - コミック(kindle除く)版の最新刊を検索して表示
#
# Author:
#   aha-oretama <sekine_y_529@msn.com>
