title: Build Lucene Synonyms
body: <p>I've the following code </p>
  
  <pre><code>static class TaggerAnalyzer extends Analyzer {
  
      @Override
      protected TokenStreamComponents createComponents(String s, Reader reader) {
  
          SynonymMap.Builder builder = new SynonymMap.Builder(true);
          builder.add(new CharsRef("al"), new CharsRef("americanleague"), true);
          builder.add(new CharsRef("al"), new CharsRef("a.l."), true);
          builder.add(new CharsRef("nba"), new CharsRef("national" + SynonymMap.WORD_SEPARATOR + "basketball" + SynonymMap.WORD_SEPARATOR + "association"), true);
  
          SynonymMap mySynonymMap = null;
          try {
              mySynonymMap = builder.build();
          } catch (IOException e) {
              e.printStackTrace();
          }
  
          Tokenizer source = new ClassicTokenizer(Version.LUCENE_40, reader);
          TokenStream filter = new StandardFilter(Version.LUCENE_40, source);
          filter = new LowerCaseFilter(Version.LUCENE_40, filter);
          filter = new SynonymFilter(filter, mySynonymMap, true);
          return new TokenStreamComponents(source, filter);
      }
  }
  </code></pre>
  
  <p>And I'm running some test, so far, everything went ok until I figured out this scenario.</p>
  
  <pre><code>    String title = "Very short title at a.l. bla bla"
  
      Assert.assertTrue(TagUtil.evaluate(memoryIndex,"americanleague"));
      Assert.assertTrue(TagUtil.evaluate(memoryIndex,"al"));
  </code></pre>
  
  <p>I was expecting that both cases ran successfully, but americanleague didn't match with "a.l." besides both "a.l." and "americanleague" are "al" synonyms.</p>
  
  <p>So, what do I do? I don't want to add all combinations to the Map. Thanks</p>