<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def searchHierarchy(self, fparent):
 		"""Core function to search directory structure for child files and folders of a parent"""

		data = []
		returnData = []
		parentslashes = fparent.count('/') 
		filecount = 0
		foldercount = 0

		#open files for folder searching
		try:
			dirFile = open(self.dirIndex, 'rt')
		except IOError:
			self.repo.printd("Error: Unable to read index file " + self.dirIndex)
			return

		#search for folders
		for fldr in dirFile:
			fldr = fldr.split('|')
			fldr = fldr[0]
			if fparent in fldr and parentslashes+1 == fldr.count('/'):
				returnData.append([fldr, fldr[fldr.rfind('/',1,-1):-1], ResultType.FOLDER])
				foldercount += 1

		dirFile.close()

		#open files for file searching
		try:
			fileFile = open(self.fileIndex, 'rt')
		except IOError:
			self.repo.printd("Error: Unable to read index file " + self.fileIndex)
			return

		try:
			nameFile = open(self.nameIndex, 'rt')
		except IOError:
			self.repo.printd("Error: Unable to read index file " + self.nameIndex)
			return

		#search for files
		for (path,name) in zip(fileFile,nameFile):
			if fparent in path and parentslashes == path.count('/'):
				returnData.append([path.strip(), name, ResultType.FILE])
				filecount += 1

		fileFile.close()
		nameFile.close()

		return [returnData, foldercount, filecount]