Template talk:Strfind short

This is the discussion/talk-page for: Template:Strfind_short.

Created
The Template:Strfind_short was created by long-term user Wikid77 on 28 December 2010, to find strings using a shorter algorithm, to handle shorter strings. However, on 29 January 2011, it was updated to check the length parameter lenstr=n for search 5x faster, stopping at the length of specific strings, and that also allowed for searching longer strings, since the length would normally be shorter for shorter strings. -Wikid77 23:33, 4 February 2011 (UTC)

Ready for use?
Is this functioning yet? If so, I'll start updating the automatic taxobox code accordingly. Bob the Wikipedian (talk • contribs) 00:50, 3 January 2011 (UTC)
 * I'm assuming that this is ready now, since it's being proposed as an addition to the italictitle. Bob the WikipediaN (talk • contribs) 22:30, 4 February 2011 (UTC)


 * Yes, it is ready for use: it was tested on various lengths of strings and seems to work fine, but I am optimizing it again to check string lengths in increments of 10, 15, 20, 25 (etc.) to be even faster, using the 80/20 Rule to focus on the most-likely titles. Sorry, it took so long to optimize, but I had imagined most actual string lengths were less than 15 (NOT!), until I saw Template:Italic_title (used in 353,000 pages), and checked 10,000 titles to reveal many are 16-25 long, with few less than 5 characters long, but also having a few over 90 long. Don't be afraid to search titles of length "99" because they are extremely rare (1-in-10,000?) and will not "slow down" Wikipedia but allow searching a vast range of exotic album titles, etc. The prior search limit of length 50 was an unfortunate oversight, but if we all focus on various aspects of processing titles, we will soon have this optimized and flexible enough to work well in most articles. -Wikid77 23:33, 4 February 2011 (UTC)
 * So my question is this-- when implementing the new, faster search, I want to replace all instances of "str find" with "strfind short", correct? Or should this be used in some places, and a different one elsewhere? I'm prepared to begin updating the taxobox templates, and I want to make sure I get this right the first time so I don't have five or six bug reports within minutes of the first change I make. Bob the WikipediaN (talk • contribs) 00:23, 5 February 2011 (UTC)
 * To replace {str_find}, with {strfind_short}, also set the length of the base string (being searched) as lenstr:
 * &bull;
 * &bull; &rarr;
 * Because the parameters differ from {str_find}, this is not a simple search-and-replace: care must be taken to check some various results, when {strfind_short} is used instead. There is a danger of misusing the parameters. In general: if you don't have time for bug reports, you don't have time to risk changes. It is not worth the risk, unless you have time to spare. I've learned that the hard way: a major change also requires time for major testing of results (and handling complaints). I wish it were simpler, but the likelihood is problems will occur, so you might want to change one thing at a time and check results, more slowly. -Wikid77
 * True that. Thanks for the advice. Bob the WikipediaN (talk • contribs) 02:54, 5 February 2011 (UTC)

Fix for hyphen
The Template:Strfind_short should be updated, from the /sandbox, to no longer ghost-match a hyphen and instead avoid matching internal prefix characters. After the update, the following should match:

Because {strfind_short} has had the bug to ghost-match a hyphen since December 2010, many users probably already know to avoid using hyphens in searches. However, after the update, then {strfind_short} could be used to search for hyphens, as well as the dashes already supported. -Wikid77 (talk) 20:57, 25 November 2012 (UTC)
 * Expected: &rarr; 0
 * Currently: &rarr;
 * Expected: &rarr; 4
 * Currently: &rarr;
 * Expected: &rarr; 0
 * Currently: &rarr;
 * Expected: &rarr; 6
 * Currently: &rarr;
 * Expected: &rarr; 0
 * Currently: &rarr;
 * Expected: &rarr; 0
 * Currently: &rarr;
 * Expected: &rarr; 15
 * Currently: &rarr;
 * Yes check.svg Done. Very nice work indeed. — Mr. Stradivarius  (have a chat) 10:46, 26 November 2012 (UTC)

Protected edit request on 31 August 2014
Can the two category tags (" " and "  ") be removed from the main template page? Both tags are already included on (i.e., provided by) the "/doc" subpage.

Jdaloner (talk) 22:15, 31 August 2014 (UTC)
 * Yes check.svg Done — Mr. Stradivarius  ♪ talk ♪ 23:38, 31 August 2014 (UTC)

How is this different from str find...
... since both now use the same string module (other than having different error codes for not found). — Guarapiranga ☎ 04:24, 29 May 2022 (UTC)