Examples of IndexableField


Examples of org.apache.lucene.index.IndexableField

  private static final String CAR_ID = ".carId";

  @Override
  public Object get(String name, Document document) {
    LegacyCarPlantPK id = new LegacyCarPlantPK();
    IndexableField field = document.getField( name + PLANT_ID );
    id.setPlantId( field.stringValue() );

    field = document.getField( name + CAR_ID );
    id.setCarId( field.stringValue() );
    return id;
  }
View Full Code Here

Examples of org.apache.lucene.index.IndexableField

    List<LuceneWork> processedQueue = LeakingLuceneBackend.getLastProcessedQueue();
    assertTrue( processedQueue.size() == 1 );
    AddLuceneWork addLuceneWork = (AddLuceneWork) processedQueue.get( 0 );
    Document doc = addLuceneWork.getDocument();

    IndexableField implicitNormField = doc.getField( "withNormsImplicit" );
    assertFalse( "norms should be stored for this field", implicitNormField.fieldType().omitNorms() );

    IndexableField explicitNormField = doc.getField( "withNormsExplicit" );
    assertFalse( "norms should be stored for this field", explicitNormField.fieldType().omitNorms() );

    IndexableField withoutNormField = doc.getField( "withoutNorms" );
    assertTrue( "norms should not be stored for this field", withoutNormField.fieldType().omitNorms() );
  }
View Full Code Here

Examples of org.apache.lucene.index.IndexableField

  private static final String TIRE_ID = ".tireId";

  @Override
  public Object get(String name, Document document) {
    LegacyTirePK id = new LegacyTirePK();
    IndexableField field = document.getField( name + CAR_ID );
    id.setCarId( field.stringValue() );
    field = document.getField( name + TIRE_ID );
    id.setTireId( field.stringValue() );
    return id;
  }
View Full Code Here

Examples of org.apache.lucene.index.IndexableField

public class PersonPKBridge implements TwoWayFieldBridge {

  @Override
  public Object get(String name, Document document) {
    PersonPK id = new PersonPK();
    IndexableField field = document.getField( name + ".firstName" );
    id.setFirstName( field.stringValue() );
    field = document.getField( name + ".lastName" );
    id.setLastName( field.stringValue() );
    return id;
  }
View Full Code Here

Examples of org.apache.lucene.index.IndexableField

  }

  private static void assertDocument(Document original, Document copy) {
    assertThat( original.getFields().size() ).isEqualTo( copy.getFields().size() );
    for ( int index = 0; index < original.getFields().size(); index++ ) {
      IndexableField field = original.getFields().get( index );
      IndexableField fieldCopy = copy.getFields().get( index );
      assertFieldEquality( (Field) field, (Field) fieldCopy );
    }
  }
View Full Code Here

Examples of org.apache.lucene.index.IndexableField

* @author Emmanuel Bernard
*/
public class TruncateFieldBridge implements FieldBridge {

  public Object get(String name, Document document) {
    IndexableField field = document.getField( name );
    return field.stringValue();
  }
View Full Code Here

Examples of org.apache.lucene.index.IndexableField

    luceneOptions.addFieldToDocument( name, fieldValue, document );
  }

  @Override
  public Object get(String name, Document document) {
    IndexableField field = document.getField( name );
      String stringValue;
      if ( field.binaryValue() != null ) {
        try {
          stringValue = CompressionTools.decompressString( field.binaryValue() );
        }
      catch (DataFormatException e) {
          throw new SearchException( "Field " + name + " looks like binary but couldn't be decompressed" );
        }
      }
      else {
        stringValue = field.stringValue();
      }
      return stringValue.substring( 3, stringValue.length() - 4 );
  }
View Full Code Here

Examples of org.apache.lucene.index.IndexableField

      }
    }

    @Override
    public Object get(String name, Document document) {
      final IndexableField field = document.getField( name );
      if ( field != null ) {
        Number numericValue = field.numericValue();
        BigDecimal bigValue = new BigDecimal( numericValue.longValue() );
        return bigValue.divide( storeFactor );
      }
      else {
        return null;
View Full Code Here

Examples of org.apache.lucene.index.IndexableField

   * document has to be added.</p>
   */
  public final void removeField(String name) {
    Iterator<IndexableField> it = fields.iterator();
    while (it.hasNext()) {
      IndexableField field = it.next();
      if (field.name().equals(name)) {
        it.remove();
        return;
      }
    }
  }
View Full Code Here

Examples of org.apache.lucene.index.IndexableField

   * document has to be added.</p>
   */
  public final void removeFields(String name) {
    Iterator<IndexableField> it = fields.iterator();
    while (it.hasNext()) {
      IndexableField field = it.next();
      if (field.name().equals(name)) {
        it.remove();
      }
    }
  }
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.