Package org.apache.lucene.document

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


      try {
        data = f.stringValue().getBytes("UTF-8");
      } catch (UnsupportedEncodingException uee) {
        warn = true;
        uee.printStackTrace();
        data = f.stringValue().getBytes();
      }
    }
    if (data == null) data = new byte[0];
    if (enc.equals("cbHex")) {
      setString(find(dialog, "unit"), "text", " bytes");
View Full Code Here


      setString(find(dialog, "unit"), "text", " bytes");
      value = Util.bytesToHex(data, 0, data.length, true);
      len = data.length;
    } else if (enc.equals("cbUtf")) {
      setString(find(dialog, "unit"), "text", " UTF-8 characters");
      value = f.stringValue();
      if (value != null) len = value.length();
    } else if (enc.equals("cbDef")) {
      setString(find(dialog, "unit"), "text", " characters");
      value = new String(data);
      len = value.length();
View Full Code Here

      setString(find(dialog, "unit"), "text", " characters");
      value = new String(data);
      len = value.length();
    } else if (enc.equals("cbDate")) {
      try {
        Date d = DateTools.stringToDate(f.stringValue());
        value = d.toString();
        len = 1;
      } catch (Exception e) {
        warn = true;
        value = Util.bytesToHex(data, 0, data.length, true);
View Full Code Here

        warn = true;
        value = Util.bytesToHex(data, 0, data.length, true);
      }
    } else if (enc.equals("cbLong")) {
      try {
        long num = NumericUtils.prefixCodedToLong(new BytesRef(f.stringValue()));
        value = String.valueOf(num);
        len = 1;
      } catch (Exception e) {
        warn = true;
        value = Util.bytesToHex(data, 0, data.length, true);
View Full Code Here

        System.arraycopy(bytes.bytes, bytes.offset, data, 0,
            bytes.length);
      }
      else {
        try {
          data = f.stringValue().getBytes("UTF-8");
        } catch (UnsupportedEncodingException uee) {
          uee.printStackTrace();
          errorMsg(uee.toString());
          data = f.stringValue().getBytes();
        }
View Full Code Here

        try {
          data = f.stringValue().getBytes("UTF-8");
        } catch (UnsupportedEncodingException uee) {
          uee.printStackTrace();
          errorMsg(uee.toString());
          data = f.stringValue().getBytes();
        }
      }
      if (data == null || data.length == 0) {
        showStatus("No data available");
        return;
View Full Code Here

    for(Enumeration e = doc1.fields(); e.hasMoreElements(); ) {
      Field field1 = (Field)e.nextElement();
      Field field2 = doc2.getField(field1.name());
      if( field2!=null ) {
        String value1 = field1.stringValue();
        String value2 = field2.stringValue();
        if( !value1.equals(value2) ) {
          return false;
        }
      } else {
        return false;
View Full Code Here

      else if (fieldable instanceof Field) {
        Field safeField = (Field) fieldable;
        if ( safeField.isBinary() ) {
          serializer.addFieldWithBinaryData( new LuceneFieldContext( safeField ) );
        }
        else if ( safeField.stringValue() != null )  {
          serializer.addFieldWithStringData( new LuceneFieldContext( safeField ) );
        }
        else if ( safeField.readerValue() != null && safeField.readerValue() instanceof Serializable )  {
          serializer.addFieldWithSerializableReaderData( new LuceneFieldContext( safeField ) );
        }
View Full Code Here

    }, new HitExtractor() {
      public Object mapHit(int id, Document document, float score) {
        List fields = new ArrayList();
        for(Enumeration e = document.fields(); e.hasMoreElements();) {
          Field field = (Field)e.nextElement();
          DocumentField documentField = new DocumentField(field.name(), field.stringValue(),
                            field.isIndexed(), field.isStored());
          fields.add(documentField);
        }
        return fields;
      }
View Full Code Here

        catch (DataFormatException e) {
          throw new SearchException( "Field " + name + " looks like binary but couldn't be decompressed" );
        }
      }
      else {
        stringValue = field.stringValue();
      }
      return stringBridge.stringToObject( stringValue );
    }
  }
}
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.