cleaned up search logic; move to index/misc from app