public void build(InputIterator iterator) throws IOException {if (iterator.hasPayloads()) {throw new IllegalArgumentException("this suggester doesn't support payloads");}if (iterator.hasContexts()) {throw new IllegalArgumentException("this suggester doesn't support contexts");}count = 0;trie = new JaspellTernarySearchTrie();trie.setMatchAlmostDiff(editDistance);BytesRef spare;final CharsRefBuilder charsSpare = new CharsRefBuilder();while ((spare = iterator.next()) != null) {final long weight = iterator.weight();if (spare.length == 0) {continue;}charsSpare.copyUTF8Bytes(spare);trie.put(charsSpare.toString(), Long.valueOf(weight));count++;}}

public void build ( InputIterator iterator ) throws IOException { if ( iterator . hasPayloads ( ) ) { throw new IllegalArgumentException ( "this suggester doesn't support payloads" ) ; } if ( iterator . hasContexts ( ) ) { throw new IllegalArgumentException ( "this suggester doesn't support contexts" ) ; } count = 0 ; trie = new JaspellTernarySearchTrie ( ) ; trie . setMatchAlmostDiff ( editDistance ) ; BytesRef spare ; final CharsRefBuilder charsSpare = new CharsRefBuilder ( ) ; while ( ( spare = iterator . next ( ) ) != null ) { final long weight = iterator . weight ( ) ; if ( spare . length == 0 ) { continue ; } charsSpare . copyUTF8Bytes ( spare ) ; trie . put ( charsSpare . toString ( ) , Long . valueOf ( weight ) ) ; count ++ ; } }
public override void Build(IInputIterator tfit){if (tfit.HasPayloads){throw new ArgumentException("this suggester doesn't support payloads");}if (tfit.Comparer != null){tfit = new UnsortedInputIterator(tfit);}if (tfit.HasContexts){throw new System.ArgumentException("this suggester doesn't support contexts");}count = 0;trie = new JaspellTernarySearchTrie { MatchAlmostDiff = editDistance };BytesRef spare;var charsSpare = new CharsRef();while ((spare = tfit.Next()) != null){long weight = tfit.Weight;if (spare.Length == 0){continue;}charsSpare.Grow(spare.Length);UnicodeUtil.UTF8toUTF16(spare.Bytes, spare.Offset, spare.Length, charsSpare);trie.Put(charsSpare.ToString(), weight);}}
