Package org.apache.lucene.index

Examples of org.apache.lucene.index.Payload


            f.setOmitNorms(true);
            document.add(f);
            if (i > 4) {
              final List<Token> tokens = new ArrayList<Token>(2);
              Token t = createToken("the", 0, 2, "text");
              t.setPayload(new Payload(new byte[]{1, 2, 3}));
              tokens.add(t);
              t = createToken("end", 3, 5, "text");
              t.setPayload(new Payload(new byte[]{2}));
              tokens.add(t);
              tokens.add(createToken("fin", 7, 9));
              TokenStream ts = new TokenStream(Token.TOKEN_ATTRIBUTE_FACTORY) {
                final AttributeImpl reusableToken = (AttributeImpl) addAttribute(CharTermAttribute.class);
                Iterator<Token> it = tokens.iterator();
View Full Code Here


  private final Payload payload;

  public MockVariableLengthPayloadFilter(Random random, TokenStream in) {
    super(in);
    this.random = random;
    this.payload = new Payload(bytes);
  }
View Full Code Here

  public MockFixedLengthPayloadFilter(Random random, TokenStream in, int length) {
    super(in);
    this.random = random;
    this.bytes = new byte[length];
    this.payload = new Payload(bytes);
  }
View Full Code Here

    * @param type the JCR property type.
    */
   public SingletonTokenStream(String value, int type)
   {
      this.value = value;
      this.payload = new Payload(new PropertyMetaData(type).toByteArray());
   }
View Full Code Here

  @Override
  public void addPayloadAttribute(byte[] payloads) {
    AttributeImpl attr = AttributeSource.AttributeFactory
        .DEFAULT_ATTRIBUTE_FACTORY
        .createAttributeInstance( PayloadAttribute.class );
    ( (PayloadAttribute) attr ).setPayload( new Payload( payloads ) );
    getAttributes().add( attr );
  }
View Full Code Here

  @Override
  public void addPayloadAttribute(byte[] payloads) {
    AttributeImpl attr = AttributeSource.AttributeFactory
        .DEFAULT_ATTRIBUTE_FACTORY
        .createAttributeInstance( PayloadAttribute.class );
    ( (PayloadAttribute) attr ).setPayload( new Payload( payloads ) );
    getAttributes().add( attr );
  }
View Full Code Here

  @Override
  public void addPayloadAttribute(byte[] payloads) {
    AttributeImpl attr = AttributeSource.AttributeFactory
        .DEFAULT_ATTRIBUTE_FACTORY
        .createAttributeInstance( PayloadAttribute.class );
    ( (PayloadAttribute) attr ).setPayload( new Payload( payloads ) );
    getAttributes().add( attr );
  }
View Full Code Here

      if (nextToken == null) {
        prefixExhausted = true;
      } else {
        previousPrefixToken.reinit(nextToken);
        // Make it a deep copy
        Payload p = previousPrefixToken.getPayload();
        if (p != null) {
          previousPrefixToken.setPayload((Payload) p.clone());
        }
        setCurrentToken(nextToken);
        return true;
      }
    }
View Full Code Here

            f.setOmitNorms(true);
            document.add(f);
            if (i > 4) {
              final List<Token> tokens = new ArrayList<Token>(2);
              Token t = createToken("the", 0, 2, "text");
              t.setPayload(new Payload(new byte[]{1, 2, 3}));
              tokens.add(t);
              t = createToken("end", 3, 5, "text");
              t.setPayload(new Payload(new byte[]{2}));
              tokens.add(t);
              tokens.add(createToken("fin", 7, 9));
              final Token reusableToken = new Token();
              TokenStream ts = new TokenStream() {
                Iterator<Token> it = tokens.iterator();
View Full Code Here

    assertEquals(2, offsetAtt.startOffset());
    assertEquals(7, offsetAtt.endOffset());
    assertEquals("wrd", typeAtt.type());
    assertEquals(3, posIncAtt.getPositionIncrement());
    assertEquals(77, flagsAtt.getFlags());
    assertEquals(new Payload(new byte[]{0,1,2,3}), payloadAtt.getPayload());
  }
View Full Code Here

TOP

Related Classes of org.apache.lucene.index.Payload

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.