title: Does CROSS APPLY WHERE clause work before cross apply or after on the results
body: <p>I am doing a custom fuzzy matching algorithm that we need in one of our inter applications. I  am trying to speed it up. When I do a cross apply against a fuzzy function to find suggested matches, I do not want to search unecessary data. </p>
  
  <p>Here is the function:</p>
  
  <pre><code>select top 5 Manufacturer,ManufacturerPartNumber,Description as ManufacturerDescription, CONVERT(money,Price) as Price,fms.Score  
  from Products_OurProducts_Products_View
      CROSS APPLY (
           select 
           dbo.FuzzyControlMatch(@objectModel, ManufacturerPartNumber) AS score
      ) AS fms
  
  ORDER BY fms.Score DESC
  </code></pre>
  
  <p>Now say my manufacturer part number sent by the user is FD1234 we do not really need to fuzzy over ALL manufacturerpartnumbers. Can I add a clause like so to get a more precise data set to fuzzy, or will this happen AFTER the cross apply already runs and only affect the final result.</p>
  
  <pre><code> select top 5 Manufacturer,ManufacturerPartNumber,Description as ManufacturerDescription, CONVERT(money,Price) as Price,fms.Score  
  from Products_OurProducts_Products_View
      CROSS APPLY (
           select 
           dbo.FuzzyControlMatch(@objectModel, ManufacturerPartNumber) AS score
      ) AS fms
   WHERE LEN(ManufacturerPartNUmber) &lt; LEN(@objectModel)+5
  </code></pre>
  
  <p>I was hoping for the cross apply to only fuzzy against items close to the length of the parameter in @objectmodel.</p>