title: Hibernate Search Analyzer for Sort
body: <p>On Hibernate Search 5.3, and I've been attempting to build an analyzer that is suitable for sorting a number of our fields indexed through Hibernate Search.  I understand that for sorting one should not analyze the field, but as long as your analyzer returns a single token I believe it is no problem, plus then you can use some of the prebuilt filters to  case insensitivity, HTML stripping, and in my case, I'd like to also only sort by the first 20 characters.</p>
  
  <p>So, something like this seems like it would work.</p>
  
  <pre><code>@AnalyzerDef(name = "sortAnalyzer", 
      tokenizer = @TokenizerDef(factory = KeywordTokenizerFactory.class) ,        
      charFilters = { @CharFilterDef(factory = HTMLStripCharFilterFactory.class) },
      filters = 
              { 
                  @TokenFilterDef(
                          factory = EdgeNGramFilterFactory.class,
                          params = {
                            @Parameter(name = "minGramSize",value = "20"),
                            @Parameter(name = "maxGramSize",value = "20")
                          }
                      ),                  
                  @TokenFilterDef(factory = LowerCaseFilterFactory.class),
                  @TokenFilterDef(factory = TrimFilterFactory.class)
              }
          ),
  </code></pre>
  
  <p>But it only works if I remove the EdgeNGramFilterFactory.  I suppose I could then just make a bridge to do the substring.  Then again, I could use a bridge to do the entire thing and set Analyze.NO.  My question is what is recommended?  Are there any advantages to a bridge vs. an analyzer?</p>
  
  <p>And any reason the analyzer I'm trying to use doesn't work?  </p>