Package org.hibernate.search.bridge

Examples of org.hibernate.search.bridge.FieldBridge


    //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 quad tree 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 SpatialFieldBridgeByQuadTree ) {
      return SpatialQueryBuilderFromCoordinates.buildSpatialQueryByQuadTree(
          spatialContext.getCoordinates(),
          spatialContext.getRadiusDistance(), // always in KM so far, no need to convert
          coordinatesField );
View Full Code Here


  }

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

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

   * @param clazz the {@code XClass} on which the annotation is defined on
   *
   * @return Returns the specified {@code FieldBridge} instance
   */
  public static FieldBridge extractType(ClassBridge cb, XClass clazz) {
    FieldBridge bridge = null;

    if ( cb != null ) {
      Class<?> impl = cb.impl();
      if ( impl != null ) {
        try {
View Full Code Here

    return bridge;
  }

  public static FieldBridge guessType(Field field, NumericField numericField, XMember member, ReflectionManager reflectionManager) {
    FieldBridge bridge;
    org.hibernate.search.annotations.FieldBridge bridgeAnn;
    //@Field bridge has priority over @FieldBridge
    if ( field != null && void.class != field.bridge().impl() ) {
      bridgeAnn = field.bridge();
    }
View Full Code Here

  private static FieldBridge doExtractType(
      org.hibernate.search.annotations.FieldBridge bridgeAnn,
      String appliedOnName,
      Class<?> appliedOnType) {
    assert bridgeAnn != null : "@FieldBridge instance cannot be null";
    FieldBridge bridge;
    Class impl = bridgeAnn.impl();
    if ( impl == void.class ) {
      throw new SearchException( "@FieldBridge with no implementation class defined in: " + appliedOnName );
    }
    try {
View Full Code Here

   */

  public static TwoWayFieldBridge extractTwoWayType(org.hibernate.search.annotations.FieldBridge fieldBridge,
                            XClass appliedOnType,
                            ReflectionManager reflectionManager) {
    FieldBridge fb = extractType( fieldBridge, appliedOnType, reflectionManager );
    if ( fb instanceof TwoWayFieldBridge ) {
      return (TwoWayFieldBridge) fb;
    }
    else {
      throw new SearchException( "FieldBridge passed in is not an instance of " + TwoWayFieldBridge.class.getSimpleName() );
View Full Code Here

   * @return FieldBridge
   */
  public static FieldBridge extractType(org.hibernate.search.annotations.FieldBridge fieldBridgeAnnotation,
                      XClass appliedOnType,
                      ReflectionManager reflectionManager) {
    FieldBridge bridge = null;

    if ( fieldBridgeAnnotation != null ) {
      bridge = doExtractType( fieldBridgeAnnotation, appliedOnType.getName(), reflectionManager.toClass( appliedOnType ) );
    }

View Full Code Here

  }

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

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

    final String fieldName = fieldContext.getField();
    final Analyzer queryAnalyzer = queryContext.getQueryAnalyzer();

    final DocumentBuilderIndexedEntity<?> documentBuilder = Helper.getDocumentBuilder( queryContext );

    FieldBridge fieldBridge = documentBuilder.getBridge(fieldContext.getField());


    final Object fromObject = rangeContext.getFrom();
    final Object toObject = rangeContext.getTo();

    if (fieldBridge!=null && NumericFieldBridge.class.isAssignableFrom(fieldBridge.getClass())) {
      perFieldQuery = NumericFieldUtils.createNumericRangeQuery(
          fieldName,
          fromObject,
          toObject,
          !rangeContext.isExcludeTo(),
View Full Code Here

        if ( idAnnotation instanceof DocumentId ) {
          explicitDocumentId = true;
        }
        idKeywordName = prefix + attributeName;

        FieldBridge fieldBridge = BridgeFactory.guessType( null, numericFieldAnn, member, reflectionManager );
        if ( fieldBridge instanceof TwoWayFieldBridge ) {
          idBridge = (TwoWayFieldBridge) fieldBridge;
        }
        else {
          throw new SearchException(
View Full Code Here

TOP

Related Classes of org.hibernate.search.bridge.FieldBridge

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.