Examples of DocumentBuilderIndexedEntity


Examples of org.hibernate.search.engine.spi.DocumentBuilderIndexedEntity

  private String objectIdInString(Class<?> entityClass, Serializable id, ConversionContext conversionContext) {
    EntityIndexBinding indexBindingForEntity = searchFactory.getIndexBinding( entityClass );
    if ( indexBindingForEntity == null ) {
      throw new SearchException( "Unable to find entity type metadata while deserializing: " + entityClass );
    }
    DocumentBuilderIndexedEntity documentBuilder = indexBindingForEntity.getDocumentBuilder();
    return documentBuilder.objectToString( documentBuilder.getIdKeywordName(), id, conversionContext );
  }
View Full Code Here

Examples of org.hibernate.search.engine.spi.DocumentBuilderIndexedEntity

      // Create all DocumentBuilderIndexedEntity
      // FIXME DocumentBuilderIndexedEntity needs to be built by a helper method receiving Class<T> to infer T properly
      // XClass unfortunately is not (yet) genericized: TODO ?
      TypeMetadata typeMetadata = metadataProvider.getTypeMetadataFor( mappedClass);
      final DocumentBuilderIndexedEntity<?> documentBuilder =
          new DocumentBuilderIndexedEntity(
              mappedXClass,
              typeMetadata,
              context,
              cfg.getReflectionManager(),
              optimizationBlackListedTypes,
View Full Code Here

Examples of org.hibernate.search.engine.spi.DocumentBuilderIndexedEntity

  public Query createQuery() {
    return queryCustomizer.setWrappedQuery( createSpatialQuery() ).createQuery();
  }

  private Query createSpatialQuery() {
    final DocumentBuilderIndexedEntity documentBuilder = Helper.getDocumentBuilder( queryContext );
    //FIXME that will have to change probably but today, if someone uses latitude / longitude
    //      we use boolean style spatial queries
    //      and on coordinates field, use spatial hash query
    // FIXME in the future we will likely react to some state stored in SpatialFieldBridge (for the indexing strategy)
    String coordinatesField = spatialContext.getCoordinatesField();
    FieldBridge fieldBridge = documentBuilder.getBridge( coordinatesField );
    if ( fieldBridge instanceof SpatialFieldBridgeByHash ) {
      return SpatialQueryBuilderFromCoordinates.buildSpatialQueryByHash(
          spatialContext.getCoordinates(),
          spatialContext.getRadiusDistance(), // always in KM so far, no need to convert
          coordinatesField );
View Full Code Here

Examples of org.hibernate.search.engine.spi.DocumentBuilderIndexedEntity

    }
  }

  private Query createQuery(FieldContext fieldContext, ConversionContext conversionContext) {
    final Query perFieldQuery;
    final DocumentBuilderIndexedEntity documentBuilder = Helper.getDocumentBuilder( queryContext );
    final FieldBridge fieldBridge = fieldContext.getFieldBridge() != null ? fieldContext.getFieldBridge() : documentBuilder.getBridge( fieldContext.getField() );
    if ( fieldBridge instanceof NumericFieldBridge ) {
      return NumericFieldUtils.createExactMatchQuery( fieldContext.getField(), value );
    }

    final String searchTerm = buildSearchTerm( fieldContext, documentBuilder, conversionContext );
View Full Code Here

Examples of org.hibernate.search.engine.spi.DocumentBuilderIndexedEntity

  }

  @Override
  public void performWork(LuceneWork work, IndexWriter writer, IndexingMonitor monitor) {
    final Class<?> entityType = work.getEntityClass();
    DocumentBuilderIndexedEntity documentBuilder = workspace.getDocumentBuilder( entityType );
    Map<String, String> fieldToAnalyzerMap = work.getFieldToAnalyzerMap();
    ScopedAnalyzer analyzer = documentBuilder.getAnalyzer();
    analyzer = updateAnalyzerMappings( workspace, analyzer, fieldToAnalyzerMap );
    if ( log.isTraceEnabled() ) {
      log.trace( "add to Lucene index: " + entityType + "#" + work.getId() + ":" + work.getDocument() );
    }
    try {
View Full Code Here

Examples of org.hibernate.search.engine.spi.DocumentBuilderIndexedEntity

  }

  @Override
  public Analyzer getAnalyzer(Class<?> clazz) {
    EntityIndexBinding entityIndexBinding = getSafeIndexBindingForEntity( clazz );
    DocumentBuilderIndexedEntity builder = entityIndexBinding.getDocumentBuilder();
    return builder.getAnalyzer();
  }
View Full Code Here

Examples of org.hibernate.search.engine.spi.DocumentBuilderIndexedEntity

      throw new SearchException( "Unable to load indexed class: " + className, e );
    }
  }

  public static Serializable getDocumentId(SearchFactoryImplementor searchFactoryImplementor, Class<?> clazz, Document document, ConversionContext conversionContext) {
    final DocumentBuilderIndexedEntity builderIndexedEntity = getDocumentBuilder(
        searchFactoryImplementor,
        clazz
    );
    final TwoWayFieldBridge fieldBridge = builderIndexedEntity.getIdBridge();
    final String fieldName = builderIndexedEntity.getIdKeywordName();
    try {
      return (Serializable) conversionContext
          .setClass( clazz )
          .pushIdentifierProperty()
          .twoWayConversionContext( fieldBridge )
View Full Code Here

Examples of org.hibernate.search.engine.spi.DocumentBuilderIndexedEntity

      conversionContext.popProperty();
    }
  }

  public static String getDocumentIdName(SearchFactoryImplementor searchFactoryImplementor, Class<?> clazz) {
    DocumentBuilderIndexedEntity documentBuilder = getDocumentBuilder( searchFactoryImplementor, clazz );
    return documentBuilder.getIdentifierName();
  }
View Full Code Here

Examples of org.hibernate.search.engine.spi.DocumentBuilderIndexedEntity

    DocumentBuilderIndexedEntity documentBuilder = getDocumentBuilder( searchFactoryImplementor, clazz );
    return documentBuilder.getIdentifierName();
  }

  public static Object[] getDocumentFields(SearchFactoryImplementor searchFactoryImplementor, Class<?> clazz, Document document, String[] fields, ConversionContext conversionContext) {
    DocumentBuilderIndexedEntity builderIndexedEntity = getDocumentBuilder( searchFactoryImplementor, clazz );
    final int fieldNbr = fields.length;
    Object[] result = new Object[fieldNbr];
    Arrays.fill( result, NOT_SET );
    conversionContext.setClass( clazz );
    if ( builderIndexedEntity.getIdKeywordName() != null ) {
      final String fieldName = builderIndexedEntity.getIdKeywordName();
      int matchingPosition = getFieldPosition( fields, fieldName );
      if ( matchingPosition != -1 ) {
        conversionContext.pushProperty( fieldName );
        try {
          populateResult(
              fieldName,
              builderIndexedEntity.getIdBridge(),
              Store.YES,
              result,
              document,
              conversionContext,
              matchingPosition
          );
        }
        finally {
          conversionContext.popProperty();
        }
      }
    }

    final TypeMetadata metadata = builderIndexedEntity.getMetadata();
    processFieldsForProjection( metadata, fields, result, document, conversionContext );
    return result;
  }
View Full Code Here

Examples of org.hibernate.search.engine.spi.DocumentBuilderIndexedEntity

  }

  public Query createQuery() {
    Query query;
    final SearchFactoryImplementor searchFactory = queryContext.getFactory();
    final DocumentBuilderIndexedEntity documentBuilder = Helper.getDocumentBuilder( queryContext );
    IndexReader indexReader = searchFactory.getIndexReaderAccessor().open( queryContext.getEntityType() );
    // retrieving the docId and building the more like this query form the term vectors must be using the same index reader
    try {
      String[] fieldNames = getAllCompatibleFieldNames( documentBuilder );
      if ( fieldsContext.size() == 0 ) {
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.