--[[----------------------------------------------------------------------------

WFCatOnlineSearchResultTableHandler.lua

--------------------------------------------------------------------------------

ADOBE CONFIDENTIAL
------------------
Copyright 2015 Adobe Systems Incorporated
All Rights Reserved.

NOTICE: All information contained herein is, and remains the property of
Adobe Systems Incorporated and its suppliers, if any. The intellectual and
technical concepts contained herein are proprietary to Adobe Systems
Incorporated and its suppliers and are protected by all applicable
intellectual property laws, including trade secret and copyright laws.
Dissemination of this information or reproduction of this material is
strictly forbidden unless prior written permission is obtained from
Adobe Systems Incorporated.

------------------------------------------------------------------------------]]

local WFRxRunUntilDone = require 'WFRxRunUntilDone'
local WFCatSearchAndSortConstants = require 'WFCatSearchAndSortConstants'

local WFCatOnlineSearchResultTableHandler = {}
--------------------------------------------------------------------------------
-- check for this value in WFCatOnlineSearchResultTable.lua
local ONLINESEARCH_TEMP_TABLE_NAME = WFCatSearchAndSortConstants.ONLINESEARCH_TEMP_TABLE_NAME

--------------------------------------------------------------------------------
function WFCatOnlineSearchResultTableHandler.updateSearchTable ( catalog, startIndex, assetIds )
	
				local value = {}
				for i = 1, #assetIds do
					local assetId = assetIds[i]
					value[i] = {
						assetId,
						startIndex + i,
					}
				end
				
				return catalog:indexStore()
					:bulkInsertManualTable( ONLINESEARCH_TEMP_TABLE_NAME, value )
					:call( WFRxRunUntilDone )
end
			
--------------------------------------------------------------------------------		
function WFCatOnlineSearchResultTableHandler.clearSearchTable( catalog )
			
				return catalog:indexStore()
					:clearManualTable( ONLINESEARCH_TEMP_TABLE_NAME )
					:call( WFRxRunUntilDone )
			
			end

--------------------------------------------------------------------------------
return WFCatOnlineSearchResultTableHandler
