Examples of Payload


Examples of org.apache.lucene.index.Payload

    }

    @Override
    public boolean incrementToken() throws IOException {
      if (input.incrementToken()) {
        payloadAttr.setPayload(new Payload(("pos: " + pos).getBytes()));
        pos++;
        return true;
      } else {
        return false;
      }
View Full Code Here

Examples of org.apache.lucene.index.Payload

     */
    public void setWeight(Token token, float weight) {
      if (weight == 1f) {
        token.setPayload(null);
      } else {
        token.setPayload(new Payload(PayloadHelper.encodeFloat(weight)));
      }
    }
View Full Code Here

Examples of org.apache.lucene.index.Payload

    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

Examples of org.apache.lucene.index.Payload

    public boolean incrementToken() {
      termAtt.setTermBuffer("accents");
      offsetAtt.setOffset(2, 7);
      typeAtt.setType("wrd");
      posIncAtt.setPositionIncrement(3);
      payloadAtt.setPayload(new Payload(new byte[]{0,1,2,3}));
      flagsAtt.setFlags(77);
      return true;
    }
View Full Code Here

Examples of org.apache.lucene.index.Payload

      assert supportedMethods.hasReusableNext;
      nextToken = next(new Token());
    }
   
    if (nextToken != null) {
      Payload p = nextToken.getPayload();
      if (p != null) {
        nextToken.setPayload((Payload) p.clone());
      }
    }
    return nextToken;
  }
View Full Code Here

Examples of org.apache.lucene.index.Payload

      if (t == null) return null;
     
      if (t instanceof POSToken) {
        POSToken pt = (POSToken) t;
        if (pt.getPartOfSpeech() == POSToken.PROPERNOUN) {
          pt.setPayload(new Payload(new byte[] {PROPER_NOUN_ANNOTATION}));
        }
        return pt;
      } else {
        return t;
      }
View Full Code Here

Examples of org.apache.lucene.index.Payload

    termAttr = (TermAttribute) input.addAttribute(TermAttribute.class);
  }

  public boolean incrementToken() throws IOException {
    if (input.incrementToken()) {
      payloadAttr.setPayload(new Payload(("pos: " + pos).getBytes()));
      int posIncr;
      if (i % 2 == 1) {
        posIncr = 1;
      } else {
        posIncr = 0;
View Full Code Here

Examples of org.apache.lucene.index.Payload

    public boolean incrementToken() throws IOException {
      boolean result = false;
      if (input.incrementToken() == true){
        if (numSeen % 2 == 0) {
          payAtt.setPayload(new Payload(payload2));
        } else {
          payAtt.setPayload(new Payload(payload4));
        }
        numSeen++;
        result = true;
      }
      return result;
View Full Code Here

Examples of org.apache.lucene.index.Payload

    TermAttribute termAtt = (TermAttribute) stream.addAttribute(TermAttribute.class);
   
    int i=0;
    while (stream.incrementToken()) {
      String term = termAtt.term();
      Payload p = payloadAtt.getPayload();
      if (p != null && p.getData().length == 1 && p.getData()[0] == PartOfSpeechAnnotatingFilter.PROPER_NOUN_ANNOTATION) {
        assertEquals("only TokenStream is a proper noun", "tokenstream", term);
      } else {
        assertFalse("all other tokens (if this test fails, the special POSToken subclass is not correctly passed through the chain)", "tokenstream".equals(term));
      }
      assertEquals(results[i], term);
View Full Code Here

Examples of org.apache.lucene.index.Payload

    Token reusableToken = new Token();
   
    int i=0;
    while ((reusableToken = stream.next(reusableToken)) != null) {
      String term = reusableToken.term();
      Payload p = reusableToken.getPayload();
      if (p != null && p.getData().length == 1 && p.getData()[0] == PartOfSpeechAnnotatingFilter.PROPER_NOUN_ANNOTATION) {
        assertEquals("only TokenStream is a proper noun", "tokenstream", term);
      } else {
        assertFalse("all other tokens (if this test fails, the special POSToken subclass is not correctly passed through the chain)", "tokenstream".equals(term));
      }
      assertEquals(results[i], term);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.