Page MenuHomePhabricator

Please make IP address search behavior configurable
Closed, ResolvedPublic

Description

Author: robe

Description:
Hi,

please make the current behavior of MediaWiki, treating IP address searches as "search contributions" configurable. This implicit search casting might be interesting on large public sites like WikiPedia, but it's troublesome for those with a small or closed user group.

We use MediaWiki internally to document our Servers and Network infrastructure; IP addresses are one of the prevalent things we document. When we search for IP addresses we expect to get all pages containing the IP address, not contributions by an user with such an address.

Having to patch includes/SearchEngine.php by hand is doable for us, but we plan to release our collection of templates and robots as a complete product to the public, and in that context this would be one additional step when deploying or upgrading Mediawiki.

Best regards,
Michael


Version: unspecified
Severity: enhancement

Details

Reference
bz19833

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 10:43 PM
bzimport added a project: MediaWiki-Search.
bzimport set Reference to bz19833.

Trevor, I'm putting this on your plate as part of the go/search behavior change for redesigned search box.

For background -- if the search term is recognized as an IP address and no article with that name exists, on 'go' search we jump to Special:Contributions on the address:

http://en.wikipedia.org/w/index.php?title=Special%3ASearch&search=155.198.79.45
->
http://en.wikipedia.org/wiki/Special:Contributions/155.198.79.45

If the contribs link is available in the dropdown but doesn't force you to go there, that's probably fine for our needs.

olivier.beaton wrote:

Configuration Option

I made a patch to add configuration option $wgEnableSearchIPContributors for LocalSettings.php

This is my very first core change and I only started writting extensions on Sept 17th, so please review.

I debated if this should be a user option under search, but decided non-admins would really wonder wth it is. Feel free to disagree and ask me to add that too.

I've been frustrated by the lack of this feature for 2+ years, my corporate wiki contains networking ips of hosts and switches (no it's not a cmdb) and I and the other admins are constantly trying to search by ip. I kept searching for an extension or configuration setting but always came up empty.

Finally today after coding a few extensions I looked into it and I see I might be able to use the hook SearchGetNearMatch to make this an extension, but I'm not certain.

That's when I thought this should really be a config setting and would be a good exercise for my first attempt at a patch.

So here it is! I used -p1 -i to apply it.

Attached:

Why do we have this behavior at all anyway? I always hated that.

olivier.beaton wrote:

Could it be for lazy admins who want to check if an unlogged in vandal also has an account?

sumanah wrote:

Added the "patch" and "need-review" keywords; Mark hopes to get someone to review the patch soon.

(In reply to comment #2)

Created attachment 9094 [details]
Configuration Option

Comments on the patch:

  • Please choose a clearer name for the $wg var if you can, the current name is not very descriptive
  • Don't use two nested if statements, but use if ( $wgFoo && ... && ... )
  • Observe whitespace conventions for your if statements

Attached:

Committed slightly modified patch in r103019 after IRC conversation.

olivier.beaton wrote:

Thanks Roan!