public void testBlendingType() throws IOException {
  BytesRef pl=new BytesRef("lake");
  long w=20;
  Input keys[]=new Input[]{new Input("top of the lake",w,pl)};
  Path tempDir=createTempDir("BlendedInfixSuggesterTest");
  Analyzer a=new StandardAnalyzer(CharArraySet.EMPTY_SET);
  BlendedInfixSuggester suggester=new BlendedInfixSuggester(newFSDirectory(tempDir),a);
  suggester.build(new InputArrayIterator(keys));
  assertEquals(w,getInResults(suggester,"top",pl,1));
  assertEquals((int)(w * (1 - 0.10 * 2)),getInResults(suggester,"the",pl,1));
  assertEquals((int)(w * (1 - 0.10 * 3)),getInResults(suggester,"lake",pl,1));
  suggester.close();
  suggester=new BlendedInfixSuggester(newFSDirectory(tempDir),a,a,AnalyzingInfixSuggester.DEFAULT_MIN_PREFIX_CHARS,BlendedInfixSuggester.BlenderType.POSITION_RECIPROCAL,1,false);
  suggester.build(new InputArrayIterator(keys));
  assertEquals(w,getInResults(suggester,"top",pl,1));
  assertEquals((int)(w * 1 / (1 + 2)),getInResults(suggester,"the",pl,1));
  assertEquals((int)(w * 1 / (1 + 3)),getInResults(suggester,"lake",pl,1));
  suggester.close();
  suggester=new BlendedInfixSuggester(newFSDirectory(tempDir),a,a,AnalyzingInfixSuggester.DEFAULT_MIN_PREFIX_CHARS,BlendedInfixSuggester.BlenderType.POSITION_EXPONENTIAL_RECIPROCAL,1,4.0,false,true,false);
  suggester.build(new InputArrayIterator(keys));
  assertEquals(w,getInResults(suggester,"top",pl,1));
  assertEquals((int)(w * 1 / (Math.pow(1 + 2,4.0))),getInResults(suggester,"the",pl,1));
  assertEquals((int)(w * 1 / (Math.pow(1 + 3,4.0))),getInResults(suggester,"lake",pl,1));
  suggester.close();
}

public void testBlendingType ( ) throws IOException { BytesRef pl = new BytesRef ( "lake" ) ; long w = 20 ; Input keys [ ] = new Input [ ] { new Input ( "top of the lake" , w , pl ) } ; Path tempDir = createTempDir ( "BlendedInfixSuggesterTest" ) ; Analyzer a = new StandardAnalyzer ( CharArraySet . EMPTY_SET ) ; BlendedInfixSuggester suggester = new BlendedInfixSuggester ( newFSDirectory ( tempDir ) , a ) ; suggester . build ( new InputArrayIterator ( keys ) ) ; assertEquals ( w , getInResults ( suggester , "top" , pl , 1 ) ) ; assertEquals ( ( int ) ( w * ( 1 - 0.10 * 2 ) ) , getInResults ( suggester , "the" , pl , 1 ) ) ; assertEquals ( ( int ) ( w * ( 1 - 0.10 * 3 ) ) , getInResults ( suggester , "lake" , pl , 1 ) ) ; suggester . close ( ) ; suggester = new BlendedInfixSuggester ( newFSDirectory ( tempDir ) , a , a , AnalyzingInfixSuggester . DEFAULT_MIN_PREFIX_CHARS , BlendedInfixSuggester . BlenderType . POSITION_RECIPROCAL , 1 , false ) ; suggester . build ( new InputArrayIterator ( keys ) ) ; assertEquals ( w , getInResults ( suggester , "top" , pl , 1 ) ) ; assertEquals ( ( int ) ( w * 1 / ( 1 + 2 ) ) , getInResults ( suggester , "the" , pl , 1 ) ) ; assertEquals ( ( int ) ( w * 1 / ( 1 + 3 ) ) , getInResults ( suggester , "lake" , pl , 1 ) ) ; suggester . close ( ) ; suggester = new BlendedInfixSuggester ( newFSDirectory ( tempDir ) , a , a , AnalyzingInfixSuggester . DEFAULT_MIN_PREFIX_CHARS , BlendedInfixSuggester . BlenderType . POSITION_EXPONENTIAL_RECIPROCAL , 1 , 4.0 , false , true , false ) ; suggester . build ( new InputArrayIterator ( keys ) ) ; assertEquals ( w , getInResults ( suggester , "top" , pl , 1 ) ) ; assertEquals ( ( int ) ( w * 1 / ( Math . pow ( 1 + 2 , 4.0 ) ) ) , getInResults ( suggester , "the" , pl , 1 ) ) ; assertEquals ( ( int ) ( w * 1 / ( Math . pow ( 1 + 3 , 4.0 ) ) ) , getInResults ( suggester , "lake" , pl , 1 ) ) ; suggester . close ( ) ; }
verify the different flavours of the blender types
