예제 #1
0
        public override BytesRef Encode(char[] buffer, int offset, int length)
        {
            float payload = float.Parse(new string(buffer, offset, length), CultureInfo.InvariantCulture); //TODO: improve this so that we don't have to new Strings

            byte[]   bytes  = PayloadHelper.EncodeSingle(payload);
            BytesRef result = new BytesRef(bytes);

            return(result);
        }
 public NumericPayloadTokenFilter(TokenStream input, float payload, string typeMatch)
     : base(input)
 {
     if (typeMatch == null)
     {
         throw new ArgumentException("typeMatch cannot be null");
     }
     //Need to encode the payload
     thePayload      = new BytesRef(PayloadHelper.EncodeSingle(payload));
     this.typeMatch  = typeMatch;
     this.payloadAtt = AddAttribute <IPayloadAttribute>();
     this.typeAtt    = AddAttribute <ITypeAttribute>();
 }
예제 #3
0
 public NumericPayloadTokenFilter(TokenStream input, float payload, string typeMatch)
     : base(input)
 {
     if (typeMatch == null)
     {
         throw new ArgumentNullException(nameof(typeMatch), "typeMatch cannot be null"); // LUCENENET specific - changed from IllegalArgumentException to ArgumentNullException (.NET convention)
     }
     //Need to encode the payload
     thePayload      = new BytesRef(PayloadHelper.EncodeSingle(payload));
     this.typeMatch  = typeMatch;
     this.payloadAtt = AddAttribute <IPayloadAttribute>();
     this.typeAtt    = AddAttribute <ITypeAttribute>();
 }