Package org.apache.lucene.document

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


            HashMap fieldMap = new HashMap();
           
            Field classNameField = doc.getField(ParsedObject.FIELDNAME_CLASSNAME);
            if(classNameField != null)
            {
                String className = classNameField.stringValue();
                o.setClassName(className);
                ObjectHandler handler = handlerFactory.getHandler(className);
               
                Set fields = handler.getFields();
                addFieldsToMap(doc, fields, multiFields);
View Full Code Here


                    if (LuceneXMLIndexer.URL_FIELD.equals(field.name()))
                        continue;
                    atts.clear();
                    atts.addAttribute(namespace, "name", "name", CDATA, field.name());
                    contentHandler.startElement(namespace, FIELD_ELEMENT, FIELD_ELEMENT, atts);
                    String value = field.stringValue();
                    contentHandler.characters(value.toCharArray(), 0, value.length());
                    contentHandler.endElement(namespace, FIELD_ELEMENT, FIELD_ELEMENT);
                }
            }
View Full Code Here

    if (obj instanceof ComparableDocument) {
      Document givenDocument = ((ComparableDocument) obj).getDocument();
      for (Fieldable field : givenDocument.getFields()) {
        Field myField = document.getField(field.name());
        //TODO: check binary or not stored fields to.
        if (myField == null || !field.stringValue().equals(myField.stringValue())) {
          return false;
        }
      }
      return true;
    }
View Full Code Here

    doc = r.document(0);
    Iterator it = doc.getFields().iterator();
    assertTrue(it.hasNext());
    Field f = (Field) it.next();
    assertEquals(f.name(), "zzz");
    assertEquals(f.stringValue(), "a b c");

    assertTrue(it.hasNext());
    f = (Field) it.next();
    assertEquals(f.name(), "aaa");
    assertEquals(f.stringValue(), "a b c");
View Full Code Here

    assertEquals(f.stringValue(), "a b c");

    assertTrue(it.hasNext());
    f = (Field) it.next();
    assertEquals(f.name(), "aaa");
    assertEquals(f.stringValue(), "a b c");

    assertTrue(it.hasNext());
    f = (Field) it.next();
    assertEquals(f.name(), "zzz");
    assertEquals(f.stringValue(), "1 2 3");
View Full Code Here

    assertEquals(f.stringValue(), "a b c");

    assertTrue(it.hasNext());
    f = (Field) it.next();
    assertEquals(f.name(), "zzz");
    assertEquals(f.stringValue(), "1 2 3");
    assertFalse(it.hasNext());
    r.close();
    w.close();
    d.close();
  }
View Full Code Here

          it2 = fields2.iterator();
          while (it1.hasNext()) {
            Field curField1 = (Field) it1.next();
            Field curField2 = (Field) it2.next();
            assertEquals("Different fields names for doc " + i + ".", curField1.name(), curField2.name());
            assertEquals("Different field values for doc " + i + ".", curField1.stringValue(), curField2.stringValue());
          }         
        }
      }
     
      // check dictionary and posting lists
View Full Code Here

        Iterator<IndexableField> itField2 = field2.iterator();
        while (itField1.hasNext()) {
          Field curField1 = (Field) itField1.next();
          Field curField2 = (Field) itField2.next();
          assertEquals("Different fields names for doc " + i + ".", curField1.name(), curField2.name());
          assertEquals("Different field values for doc " + i + ".", curField1.stringValue(), curField2.stringValue());
        }         
      }
    }
   
    // check dictionary and posting lists
View Full Code Here

             
      Enumeration e = doc.fields();
      while (e.hasMoreElements()) {
         Field field = (Field)e.nextElement();
         if (field.name().equals("date")) {
           date=Long.parseLong(field.stringValue());   
         }
         else {
           throw new IOException("Wrong field read.");
         }
      }
View Full Code Here

      doc = reader.document(i, new MapFieldSelector(new String[]{"date","url","subType"}));     
      Enumeration e = doc.fields();
      while (e.hasMoreElements()) {
         Field field = (Field)e.nextElement();                  
         if (field.name().equals("date")) {
           idate=stringdateToInt(field.stringValue());          
         }
         else if (field.name().equals("url")) {
           url=field.stringValue();
         }
         else if (field.name().equals("subType")) {
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.