Package org.apache.lucene.document

Examples of org.apache.lucene.document.Fieldable


    //If we still didn't know the value using any bridge, return the raw string:
    for ( int index = 0; index < result.length; index++ ) {
      if ( result[index] == NOT_SET ) {
        result[index] = null; // make sure we never return NOT_SET
        if ( document != null ) {
          Fieldable field = document.getFieldable( fields[index] );
          if ( field != null ) {
            result[index] = extractStringFromFieldable( field );
          }
        }
      }
View Full Code Here


      value = ReflectionHelper.getMemberValue( unproxiedInstance, typeMetadata.getDiscriminatorGetter() );
    }

    // now we give the discriminator the opportunity to specify a analyzer per field level
    for ( Object o : doc.getFields() ) {
      Fieldable field = (Fieldable) o;
      if ( !processedFieldNames.contains( field.name() ) ) {
        String analyzerName = discriminator.getAnalyzerDefinitionName( value, unproxiedInstance, field.name() );
        if ( analyzerName != null ) {
          fieldToAnalyzerMap.put( field.name(), analyzerName );
        }
        processedFieldNames.add( field.name() );
      }
    }
  }
View Full Code Here

  public String objectToString(Object object) {
    return stringBridge.objectToString( object );
  }

  public Object get(String name, Document document) {
    Fieldable field = document.getFieldable( name );
    if ( field == null ) {
      return stringBridge.stringToObject( null );
    }
    else {
      String stringValue = DocumentBuilderHelper.extractStringFromFieldable(field);
View Full Code Here

    //If we still didn't know the value using any bridge, return the raw string:
    for ( int index = 0; index < result.length; index++ ) {
      if ( result[index] == NOT_SET ) {
        result[index] = null; // make sure we never return NOT_SET
        if ( document != null ) {
          Fieldable field = document.getFieldable( fields[index] );
          if ( field != null ) {
            result[index] = extractStringFromFieldable( field );
          }
        }
      }
View Full Code Here

      value = ReflectionHelper.getMemberValue( unproxiedInstance, propertiesMetadata.discriminatorGetter );
    }

    // now we give the discriminator the opportunity to specify a analyzer per field level
    for ( Object o : doc.getFields() ) {
      Fieldable field = (Fieldable) o;
      if ( !processedFieldNames.contains( field.name() ) ) {
        String analyzerName = discriminator.getAnalyzerDefinitionName( value, unproxiedInstance, field.name() );
        if ( analyzerName != null ) {
          fieldToAnalyzerMap.put( field.name(), analyzerName );
        }
        processedFieldNames.add( field.name() );
      }
    }
  }
View Full Code Here

      value = ReflectionHelper.getMemberValue( unproxiedInstance, propertiesMetadata.discriminatorGetter );
    }

    // now we give the discriminator the opportunity to specify a analyzer per field level
    for ( Object o : doc.getFields() ) {
      Fieldable field = (Fieldable) o;
      if ( !processedFieldNames.contains( field.name() ) ) {
        String analyzerName = discriminator.getAnalyzerDefinitionName( value, unproxiedInstance, field.name() );
        if ( analyzerName != null ) {
          fieldToAnalyzerMap.put( field.name(), analyzerName );
        }
        processedFieldNames.add( field.name() );
      }
    }
  }
View Full Code Here

         // mark the document that reindexing is required
         copy.add(new Field(FieldNames.REINDEXING_REQUIRED, "", Field.Store.NO, Field.Index.NOT_ANALYZED_NO_NORMS));
         Iterator fields = doc.getFields().iterator();
         while (fields.hasNext())
         {
            Fieldable f = (Fieldable)fields.next();
            Fieldable field = null;
            Field.TermVector tv = getTermVectorParameter(f);
            Field.Store stored = getStoreParameter(f);
            Field.Index indexed = getIndexParameter(f);
            if (f instanceof LazyTextExtractorField || f.readerValue() != null)
            {
               // replace all readers with empty string reader
               field = new Field(f.name(), new StringReader(""), tv);
            }
            else if (f.stringValue() != null)
            {
               field = new Field(f.name(), f.stringValue(), stored, indexed, tv);
            }
            else if (f.isBinary())
            {
               field = new Field(f.name(), f.binaryValue(), stored);
            }
            if (field != null)
            {
               field.setOmitNorms(f.getOmitNorms());
               copy.add(field);
            }
         }
         // schedule the original document for later indexing
         Document existing = indexingQueue.addDocument(doc);
View Full Code Here

    */
   public static void disposeDocument(Document old)
   {
      for (Iterator it = old.getFields().iterator(); it.hasNext();)
      {
         Fieldable f = (Fieldable)it.next();
         try
         {
            if (f.readerValue() != null)
            {
               f.readerValue().close();
            }
            else if (f instanceof LazyTextExtractorField)
            {
               LazyTextExtractorField field = (LazyTextExtractorField)f;
               field.dispose();
View Full Code Here

    */
   public static boolean isDocumentReady(Document doc)
   {
      for (Iterator it = doc.getFields().iterator(); it.hasNext();)
      {
         Fieldable f = (Fieldable)it.next();
         if (f instanceof LazyTextExtractorField)
         {
            LazyTextExtractorField field = (LazyTextExtractorField)f;
            if (!field.isExtractorFinished())
            {
View Full Code Here

                        // find the right fields to transfer
                        Fieldable[] fields = aDoc.getFieldables(FieldNames.PROPERTIES);
                        Token t = new Token();
                        for (int k = 0; k < fields.length; k++)
                        {
                           Fieldable field = fields[k];
                           // assume properties fields use
                           // SingleTokenStream
                           t = field.tokenStreamValue().next(t);
                           String value = new String(t.termBuffer(), 0, t.termLength());
                           if (value.startsWith(namePrefix))
                           {
                              // extract value
                              value = value.substring(namePrefix.length());
                              // create new named value
                              QPath p = getRelativePath(state, propState);
                              String path = getNamespaceMappings().translatePath(p);
                              value = FieldNames.createNamedValue(path, value);
                              t.setTermBuffer(value);
                              doc.add(new Field(field.name(), new SingletonTokenStream(t)));
                              doc.add(new Field(FieldNames.AGGREGATED_NODE_UUID, parent.getIdentifier(),
                                 Field.Store.NO, Field.Index.NOT_ANALYZED_NO_NORMS));
                           }
                        }
                     }
View Full Code Here

TOP

Related Classes of org.apache.lucene.document.Fieldable

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.