DoubleRun asked about the IP Lookup feature in Discourse, specifically which IP (Last or Registration) it searches for. Simsnet explained that the feature works with both registered and last logged-in IP, listing each account only once.
DoubleRun further clarified that the Last search only searches for matching Last IPs, and the Registered search only searches for matching Registered IPs. Simsnet provided a detailed explanation, using a database analogy and sharing the SQL query used to locate users with matching IPs. The search field uses a SELECT ... WHERE ... query to search columns, including usernames, emails, and IPs.
I know Discourse logs the Last IP and the Registration IP of users, and I was wondering which one of these the Lookup feature searches for.
Since there is an option to look up the both the Last and Registration IPs individually, I presume Last searches for other matching Last IPs and Registration searches for other matching Registration IPs?
If someone could just clarify this that would be great, thanks.
Picture a giant table with rows and columns, all of the data is filled in from user accounts. Each column has different fields, like usernames, email, how old the user is, and more, and there is a user in every row.
That search field is using a SELECT ... WHERE ... SQL query searching the columns of usernames, emails, registered IP OR last logged in IP. If a user has a matching IP in their row, it will be displayed in search results.
According to the profiler, this is the SQL query it performs to locate the users (IP censored):
Where are you looking up the IPs at? I’m assuming you’re using the search bar at the top of the user list in Admin.