title: Help me optimize my indexed string search
body: <p>So as an exercise, I'm building an algorithm to make searching for words (arbitrary sets of characters) within larger strings as fast as possible.  With almost no previous knowledge of existing search algorithms, my approach so far has been the following:</p>
  
  <ol>
  <li>Map out occurrences of pairs of characters within the larger string (Pair -> List of positions).</li>
  <li>For each pair, store also the number of occurrences found within the larger string.</li>
  <li>Get all character pairs within the search word.</li>
  <li>Using the gotten pair that occurs least often in the string, check at each position for the remaining characters of the search term for a match.</li>
  </ol>
  
  <p>That's the gist of it.  I suppose I could use maps with longer characters, but for now I'm just using pairs.</p>
  
  <p>Is there much else I can do to make it faster?  Am I approaching this the right way?</p>