#!/bin/bash
# Licensed Materials - Property of IBM
# 5724-I68
#
# (C) Copyright IBM Corp. 2000, 2006
#
# US Government Users Restricted Rights - Use, duplication, or
# disclosure restricted by GSA ADP Schedule Contract with IBM Corp.

# The purpose of this script is to regenerate indices for entities i.e items and categories.If the index option for any of the attribute
# of the spec associated with the item or category is changed after some items or categories are created, then this script needs to be run
# to regenerate indices. This will ensure that the search results based on the changed attribute(s) returns correct result. 

# 
# # Copyright (c) 2000, 2004 IBM Corp. - All Rights Reserved.
# # IBM makes no representations or warranties about the suitability of
# # this program, either express or implied, including but not limited to
# # the implied warranties of merchantability, fitness for a particular
# # purpose, or non-infringement. 
# 
#


IMPORT_MEM_FLAGS="-Xmx1024m -Xms1024m"

JIMPORT="${JAVA_RT} ${IMPORT_MEM_FLAGS}"

eval ${JIMPORT} com.ibm.ccd.content.common.IndexRegeneratorFast $*

exitCode=$?


export _CCD_CONFIRM_DB="no"
tempLog=${TOP}/logs/default/default.log



# Check for the exit code of IndexRegenerator. If it is successful, then run analyze_schems.
if [  ${exitCode} = 0 ]; then
	${TOP}/src/db/schema/util/analyze_schema.sh >> ${tempLog}
fi
export _CCD_CONFIRM_DB="yes"
