示例#1
0
        protected internal virtual string EncodeCollationKey(sbyte[] keyBits)
        {
            // Ensure that the backing char[] array is large enough to hold the encoded
            // Binary String
            int encodedLength = IndexableBinaryStringTools.GetEncodedLength(keyBits, 0, keyBits.Length);

            char[] encodedBegArray = new char[encodedLength];
            IndexableBinaryStringTools.Encode(keyBits, 0, keyBits.Length, encodedBegArray, 0, encodedLength);
            return(new string(encodedBegArray));
        }
示例#2
0
        public override bool IncrementToken()
        {
            if (this.m_input.IncrementToken())
            {
                var collationKey  = this.collator.GetSortKey(this.termAtt.ToString()).KeyData.ToSByteArray();
                var encodedLength = IndexableBinaryStringTools.GetEncodedLength(collationKey, 0, collationKey.Length);
                this.termAtt.ResizeBuffer(encodedLength);
                this.termAtt.Length = encodedLength;

                IndexableBinaryStringTools.Encode(collationKey, 0, collationKey.Length, this.termAtt.Buffer, 0, encodedLength);
                return(true);
            }
            else
            {
                return(false);
            }
        }
示例#3
0
 public override bool IncrementToken()
 {
     if (m_input.IncrementToken())
     {
         char[] termBuffer = termAtt.Buffer;
         string termText   = new string(termBuffer, 0, termAtt.Length);
         collator.GetRawCollationKey(termText, reusableKey);
         int encodedLength = IndexableBinaryStringTools.GetEncodedLength(
             reusableKey.Bytes, 0, reusableKey.Length);
         if (encodedLength > termBuffer.Length)
         {
             termAtt.ResizeBuffer(encodedLength);
         }
         termAtt.SetLength(encodedLength);
         IndexableBinaryStringTools.Encode(reusableKey.Bytes, 0, reusableKey.Length,
                                           termAtt.Buffer, 0, encodedLength);
         return(true);
     }
     else
     {
         return(false);
     }
 }