Package org.apache.lucene.index

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


      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

      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

    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

    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

    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

    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

   
    Token token;
    int i=0;
    while ((token = stream.next()) != null) {
      String term = token.term();
      Payload p = token.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

    @Override
    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

    @Override
    public boolean incrementToken() throws IOException {
      boolean hasNext = input.incrementToken();
      if (hasNext) {
        if (fieldName.equals("field")) {
          payloadAtt.setPayload(new Payload(payloadField));
        } else if (fieldName.equals("multiField")) {
          if (numSeen % 2 == 0) {
            payloadAtt.setPayload(new Payload(payloadMultiField1));
          } else {
            payloadAtt.setPayload(new Payload(payloadMultiField2));
          }
          numSeen++;
        }
        return true;
      } else {
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.