Also, 'needle' presumably refers to finding a needle in a haystack (
https://dictionary.cambridge.org/dictionary/english/needle-in-a-haystack), where the list is the haystack!
The use of this term is probably paying homage to the C run-time library's strstr() function (and friends):
STRSTR(3) Library Functions Manual STRSTR(3)
NAME
strstr, strcasestr, strnstr – locate a substring in a string
LIBRARY
Standard C Library (libc, -lc)
SYNOPSIS
#include <string.h>
char *strstr(const char *haystack, const char *needle);
...
DESCRIPTION
The strstr() function locates the first occurrence of the null-terminated string needle in the null-terminated string
haystack.