Package org.apache.lucene.index

Examples of org.apache.lucene.index.Payload


  public Token next(final Token reusableToken) throws IOException {
    assert reusableToken != null;
    Token nextToken = input.next(reusableToken);
    if (nextToken != null && nextToken.type() != null && nextToken.type().equals("") == false){
      nextToken.setPayload(new Payload(nextToken.type().getBytes("UTF-8")));
    }
    return nextToken;
  }
View Full Code Here


  public Token next() throws IOException {
    final Token reusableToken = new Token();
    Token nextToken = next(reusableToken);

    if (nextToken != null) {
      Payload p = nextToken.getPayload();
      if (p != null) {
        nextToken.setPayload((Payload) p.clone());
      }
    }

    return nextToken;
  }
View Full Code Here

    public boolean incrementToken() throws IOException {
      boolean result = false;
      if (input.incrementToken()) {
        String docid = termAtt.term();
        termAtt.setTermBuffer(LsiIndex.PAYLOAD_TERM_TEXT);
        payAtt.setPayload(new Payload(PayloadEncoder.encodePayloadId(docid)));
        return true;
      }
      return result;
    }
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 (result != null) {
        String token = new String(result.termBuffer(), 0, result.termLength());

        if (!nopayload.contains(token)) {
          if (entities.contains(token)) {
            result.setPayload(new Payload((token + ":Entity:"+ pos ).getBytes()));
          } else {
            result.setPayload(new Payload((token + ":Noise:" + pos ).getBytes()));
          }
        }
        pos += result.getPositionIncrement();
      }
      return result;
View Full Code Here

    public Token next() throws IOException {
      Token result = input.next();
      if (result != null) {
        if (fieldName.equals(FIELD))
        {
          result.setPayload(new Payload(payloadField));
        }
        else if (fieldName.equals(MULTI_FIELD))
        {
          if (numSeen  % 2 == 0)
          {
            result.setPayload(new Payload(payloadMultiField1));
          }
          else
          {
            result.setPayload(new Payload(payloadMultiField2));
          }
          numSeen++;
        }

      }
View Full Code Here

    public Token next(final Token reusableToken) throws IOException {
      assert reusableToken != null;
      Token nextToken = input.next(reusableToken);
      if (nextToken != null) {
        if (fieldName.equals("field")) {
          nextToken.setPayload(new Payload(payloadField));
        } else if (fieldName.equals("multiField")) {
          if (numSeen % 2 == 0) {
            nextToken.setPayload(new Payload(payloadMultiField1));
          } else {
            nextToken.setPayload(new Payload(payloadMultiField2));
          }
          numSeen++;
        }

      }
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));
              document.add(new Field("f", new TokenStream() {
                Iterator<Token> it = tokens.iterator();
View Full Code Here

  public void testFilterTokens() throws Exception {
    final Token tok = new Token(2, 7, "wrd");
    tok.setTermBuffer("accents");
    tok.setPositionIncrement(3);
    Payload tokPayload = new Payload(new byte[]{0,1,2,3});
    tok.setPayload(tokPayload);
    int tokFlags = 77;
    tok.setFlags(tokFlags);

    SnowballFilter filter = new SnowballFilter(
View Full Code Here

  public Token next() throws IOException {
    final Token reusableToken = new Token();
    Token nextToken = next(reusableToken);

    if (nextToken != null) {
      Payload p = nextToken.getPayload();
      if (p != null) {
        nextToken.setPayload((Payload) p.clone());
      }
    }

    return nextToken;
  }
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.