def searchByReference(self,reference):
     if reference in self.cache:
         return self.cache[reference][0]
     else:
         result = [models.ingridientModel().mapFromDict(s) for s in self.data if s['NDB_No'] == reference ]
         self.cache[reference] = result
         return result[0] if result else None
 def search(self,searchTerm):
     
     #store result into cache to avoid iteration every time
     if searchTerm in self.cache:
         return self.cache[searchTerm]
     else:
         result = [models.ingridientModel().mapFromDict(s) for s in self.data if self._contains(searchTerm.lower(),s['Shrt_Desc'].lower()) or str(s['NDB_No']) == searchTerm ][:40]
         self.cache[searchTerm] = result
         return result
 def searchByReferences(self,references):
     result =[]
     for reference in references:  
         result = result + [models.ingridientModel().mapFromDict(s) for s in self.data if s['NDB_No'] == reference ]
         
     return result