Package org.apache.lucene.document

Examples of org.apache.lucene.document.Fieldable.stringValue()


      Fieldable f2 = ff2.get(i);
      if (f1.isBinary()) {
        assert(f2.isBinary());
      } else {
        String s1 = f1.stringValue();
        String s2 = f2.stringValue();
        assertEquals(ff1 + " : " + ff2, s1,s2);
      }
    }
  }
View Full Code Here


          final TokenStream tokenStream;
          // todo readerValue(), binaryValue()
          if (field.tokenStreamValue() != null) {
            tokenStream = field.tokenStreamValue();
          } else {
            tokenStream = analyzer.tokenStream(field.name(), new StringReader(field.stringValue()));
          }

          // reset the TokenStream to the first token         
          tokenStream.reset();
View Full Code Here

          }
          tokenStream.end();
          tokenStream.close();
        } else {
          // untokenized
          String fieldVal = field.stringValue();
          Token token = new Token(0, fieldVal.length(), "untokenized");
          token.setTermBuffer(fieldVal);
          tokens.add(token);
          fieldSetting.fieldLength++;
        }
View Full Code Here

          if (d.get("content3") != null) continue;
          count++;
          Fieldable compressed = d.getFieldable("compressed");
          if (Integer.parseInt(d.get("id")) % 2 == 0) {
            assertFalse(compressed.isBinary());
            assertEquals("incorrectly decompressed string", TEXT_TO_COMPRESS, compressed.stringValue());
          } else {
            assertTrue(compressed.isBinary());
            assertTrue("incorrectly decompressed binary", Arrays.equals(BINARY_TO_COMPRESS, compressed.getBinaryValue()));
          }
        }
View Full Code Here

      = new HashMap<String, CategoryHits>();
   
    for (ScoreDoc sd: results.scoreDocs) { //<co id="mlt.collect"/>
      Document d = indexReader.document(sd.doc);
      Fieldable f = d.getFieldable(categoryFieldName);
      String cat = f.stringValue();
      CategoryHits ch = categoryHash.get(cat);
      if (ch == null) {
        ch = new CategoryHits();
        ch.setLabel(cat);
        categoryHash.put(cat, ch);
View Full Code Here

      f.add( "type", (ftype==null)?null:ftype.getTypeName() );
      f.add( "schema", getFieldFlags( sfield ) );
      f.add( "flags", getFieldFlags( fieldable ) );

      Term t = new Term(fieldable.name(), ftype!=null ? ftype.storedToIndexed(fieldable) : fieldable.stringValue());

      f.add( "value", (ftype==null)?null:ftype.toExternal( fieldable ) );

      // TODO: this really should be "stored"
      f.add( "internal", fieldable.stringValue() )// may be a binary number
View Full Code Here

      Term t = new Term(fieldable.name(), ftype!=null ? ftype.storedToIndexed(fieldable) : fieldable.stringValue());

      f.add( "value", (ftype==null)?null:ftype.toExternal( fieldable ) );

      // TODO: this really should be "stored"
      f.add( "internal", fieldable.stringValue() )// may be a binary number

      byte[] arr = fieldable.getBinaryValue();
      if (arr != null) {
        f.add( "binary", Base64.byteArrayToBase64(arr, 0, arr.length));
      }
View Full Code Here

  protected String getDocClass(int doc) throws IOException {
    Document d = indexReader.document(doc);
    Fieldable f = d.getFieldable(categoryFieldName);
    if (f == null) return null;
    if (!f.isStored()) throw new IllegalArgumentException("Field " + f.name() + " is not stored.");
    return f.stringValue();
  }
 
  public static void main(String[] args) throws Exception {
    DefaultOptionBuilder obuilder = new DefaultOptionBuilder();
    ArgumentBuilder abuilder = new ArgumentBuilder();
View Full Code Here

      for (Iterator<Fieldable> fi = fields.iterator(); fi.hasNext(); ) {
        Fieldable f=null;
        try {
          f =  fi.next();
          String fname = f.name();
          String fval = f.stringValue();
          assertNotNull(docs[i]+" FIELD: "+fname, fval);
          String[] vals = fval.split("#");
          if (!dataset.contains(vals[0]) || !dataset.contains(vals[1])) {       
            fail("FIELD:"+fname+",VAL:"+fval);
          }
View Full Code Here

          if (d.get("content3") != null) continue;
          count++;
          Fieldable compressed = d.getFieldable("compressed");
          if (Integer.parseInt(d.get("id")) % 2 == 0) {
            assertFalse(compressed.isBinary());
            assertEquals("incorrectly decompressed string", TEXT_TO_COMPRESS, compressed.stringValue());
          } else {
            assertTrue(compressed.isBinary());
            assertTrue("incorrectly decompressed binary", Arrays.equals(BINARY_TO_COMPRESS, compressed.getBinaryValue()));
          }
        }
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.