<p dir="auto">This would be a breaking change, so probably it will be rejected, but anyway:</p>
<p dir="auto">The function call <code class="notranslate">searchsorted(v, key, by=mytransform)</code> applies <code class="notranslate">mytransform</code> to <code class="notranslate">key</code>, which isn't helpful.  It would be more useful if the <code class="notranslate">searchsorted</code> function assumes that the key is already of the type equal to the output of <code class="notranslate">mytransform</code>.  The common use for <code class="notranslate">searchsorted</code> is to search the sorted array <code class="notranslate">v</code> for a particular key that is a field or is computed from the fields of the array entries.  Typically, the user would know the key but would not want to construct a dummy record whose type is <code class="notranslate">eltype(v)</code> just to hold that key.</p>
<p dir="auto">Just to be clear, here is a trace of what I mean.  I think the first invocation sequence (that gives the error) is more useful than the second.</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="julia&gt; v = [(2,5), (3,9), (12,15)]
3-element Array{Tuple{Int64,Int64},1}:
 (2, 5)
 (3, 9)
 (12, 15)

julia&gt; searchsortedfirst(v, 7, by = a-&gt; a[2])
ERROR: BoundsError
Stacktrace:
 [1] getindex at .\number.jl:78 [inlined]
 [2] #5 at .\REPL[4]:1 [inlined]
 [3] lt at .\ordering.jl:51 [inlined]
 [4] searchsortedfirst at .\sort.jl:178 [inlined]
 [5] searchsortedfirst at .\sort.jl:291 [inlined]
 [6] #searchsortedfirst#4 at .\sort.jl:293 [inlined]
 [7] (::getfield(Base.Sort, Symbol(&quot;#kw##searchsortedfirst&quot;)))(::NamedTuple{(:by,),Tuple{getfield(Main, Symbol(&quot;##5#6&quot;))}}, ::typeof(searchsortedfirst), ::Array{Tuple{Int64,Int64},1}, ::Int64) at .\none:0
 [8] top-level scope at REPL[4]:1

julia&gt; searchsortedfirst(v, (99999,7), by = a-&gt; a[2])
2"><pre class="notranslate"><code class="notranslate">julia&gt; v = [(2,5), (3,9), (12,15)]
3-element Array{Tuple{Int64,Int64},1}:
 (2, 5)
 (3, 9)
 (12, 15)

julia&gt; searchsortedfirst(v, 7, by = a-&gt; a[2])
ERROR: BoundsError
Stacktrace:
 [1] getindex at .\number.jl:78 [inlined]
 [2] #5 at .\REPL[4]:1 [inlined]
 [3] lt at .\ordering.jl:51 [inlined]
 [4] searchsortedfirst at .\sort.jl:178 [inlined]
 [5] searchsortedfirst at .\sort.jl:291 [inlined]
 [6] #searchsortedfirst#4 at .\sort.jl:293 [inlined]
 [7] (::getfield(Base.Sort, Symbol("#kw##searchsortedfirst")))(::NamedTuple{(:by,),Tuple{getfield(Main, Symbol("##5#6"))}}, ::typeof(searchsortedfirst), ::Array{Tuple{Int64,Int64},1}, ::Int64) at .\none:0
 [8] top-level scope at REPL[4]:1

julia&gt; searchsortedfirst(v, (99999,7), by = a-&gt; a[2])
2
</code></pre></div>
<p dir="auto">Consider this:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="using Base.Dates: Second

immutable tsp # time series point
    t :: DateTime
    y :: Float64
end

t0 = now()
S = [tsp(t0+Second(10), 42), tsp(t0+Second(13), -1), tsp(t0+Second(17), 31)]

searchsortedfirst(S, t0+Second(12), by=x -&gt; x.t)
searchsortedfirst(S, tsp(t0+Second(12), NaN), by=x -&gt; x.t)"><pre class="notranslate"><code class="notranslate">using Base.Dates: Second

immutable tsp # time series point
    t :: DateTime
    y :: Float64
end

t0 = now()
S = [tsp(t0+Second(10), 42), tsp(t0+Second(13), -1), tsp(t0+Second(17), 31)]

searchsortedfirst(S, t0+Second(12), by=x -&gt; x.t)
searchsortedfirst(S, tsp(t0+Second(12), NaN), by=x -&gt; x.t)
</code></pre></div>
<p dir="auto">The first search call fails and the second is not ideal because one has to use a dummy value (NaN here) to fill in the parts of the item being searched that are not part of the key. I think that in <code class="notranslate">searchsortedfirst(S, x, by=f)</code> it would make more sense to apply f() to the items of <em>S</em> but not to the item <em>x</em>. If the searchsorted functions worked like that, then the current behavior is easily obtained by using <code class="notranslate">searchsortedfirst(S, f(x), by=f)</code>. Inversion of f() is not necessarily as easy.</p>