Extracting search logic into a different model