Java 类org.apache.lucene.analysis.charfilter.MappingCharFilter 实例源码

项目:search    文件:TestPathHierarchyTokenizer.java   
public void testNormalizeWinDelimToLinuxDelim() throws Exception {
  NormalizeCharMap.Builder builder = new NormalizeCharMap.Builder();
  builder.add("\\", "/");
  NormalizeCharMap normMap = builder.build();
  String path = "c:\\a\\b\\c";
  Reader cs = new MappingCharFilter(normMap, new StringReader(path));
  PathHierarchyTokenizer t = new PathHierarchyTokenizer(newAttributeFactory(), cs, DEFAULT_DELIMITER, DEFAULT_DELIMITER, DEFAULT_SKIP);
  assertTokenStreamContents(t,
      new String[]{"c:", "c:/a", "c:/a/b", "c:/a/b/c"},
      new int[]{0, 0, 0, 0},
      new int[]{2, 4, 6, 8},
      new int[]{1, 0, 0, 0},
      path.length());
}
项目:gerrit    文件:CustomMappingAnalyzer.java   
@Override
protected Reader wrapReader(String fieldName, Reader reader) {
  NormalizeCharMap.Builder builder = new NormalizeCharMap.Builder();
  for (Map.Entry<String, String> e : customMappings.entrySet()) {
    builder.add(e.getKey(), e.getValue());
  }
  return new MappingCharFilter(builder.build(), reader);
}
项目:NYBC    文件:TestPathHierarchyTokenizer.java   
public void testNormalizeWinDelimToLinuxDelim() throws Exception {
  NormalizeCharMap.Builder builder = new NormalizeCharMap.Builder();
  builder.add("\\", "/");
  NormalizeCharMap normMap = builder.build();
  String path = "c:\\a\\b\\c";
  Reader cs = new MappingCharFilter(normMap, new StringReader(path));
  PathHierarchyTokenizer t = new PathHierarchyTokenizer( cs );
  assertTokenStreamContents(t,
      new String[]{"c:", "c:/a", "c:/a/b", "c:/a/b/c"},
      new int[]{0, 0, 0, 0},
      new int[]{2, 4, 6, 8},
      new int[]{1, 0, 0, 0},
      path.length());
}
项目:Maskana-Gestor-de-Conocimiento    文件:TestPathHierarchyTokenizer.java   
public void testNormalizeWinDelimToLinuxDelim() throws Exception {
  NormalizeCharMap.Builder builder = new NormalizeCharMap.Builder();
  builder.add("\\", "/");
  NormalizeCharMap normMap = builder.build();
  String path = "c:\\a\\b\\c";
  Reader cs = new MappingCharFilter(normMap, new StringReader(path));
  PathHierarchyTokenizer t = new PathHierarchyTokenizer( cs );
  assertTokenStreamContents(t,
      new String[]{"c:", "c:/a", "c:/a/b", "c:/a/b/c"},
      new int[]{0, 0, 0, 0},
      new int[]{2, 4, 6, 8},
      new int[]{1, 0, 0, 0},
      path.length());
}
项目:lucene-tokenizers-for-multilang    文件:MultistageMappingCharFilterFactory.java   
@Override
public Reader create(Reader input) {
    for (NormalizeCharMap charMap : normMapList) {
        input = charMap == null ? input : new MappingCharFilter(charMap,
                input);
    }
    return input;
}
项目:elasticsearch_my    文件:MappingCharFilterFactory.java   
@Override
public Reader create(Reader tokenStream) {
    return new MappingCharFilter(normMap, tokenStream);
}
项目:Elasticsearch    文件:MappingCharFilterFactory.java   
@Override
public Reader create(Reader tokenStream) {
    return new MappingCharFilter(normMap, tokenStream);
}
项目:elasticsearch-ukrainian-lemmatizer    文件:UkrainianAnalyzer.java   
@Override
protected Reader initReader(String fieldName, Reader reader) {
    return new MappingCharFilter(UkrainianLemmatizerResources.NORMALIZE_MAP, reader);
}
项目:NYBC    文件:MappingCharFilterFactory.java   
@Override
public Reader create(Reader input) {
  // if the map is null, it means there's actually no mappings... just return the original stream
  // as there is nothing to do here.
  return normMap == null ? input : new MappingCharFilter(normMap,input);
}