001    /**
002     * Copyright (c) 2000-present Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portal.kernel.search.filter;
016    
017    import com.liferay.portal.kernel.search.geolocation.GeoDistance;
018    import com.liferay.portal.kernel.search.geolocation.GeoLocationPoint;
019    
020    /**
021     * @author Michael C. Han
022     */
023    public class GeoDistanceRangeFilter extends RangeTermFilter {
024    
025            public GeoDistanceRangeFilter(
026                    String field, boolean includesLower, boolean includesUpper,
027                    GeoDistance lowerBoundGeoDistance, GeoLocationPoint pinGeoLocationPoint,
028                    GeoDistance upperBoundGeoDistance) {
029    
030                    super(field, includesLower, includesUpper);
031    
032                    _lowerBoundGeoDistance = lowerBoundGeoDistance;
033                    _pinGeoLocationPoint = pinGeoLocationPoint;
034                    _upperBoundGeoDistance = upperBoundGeoDistance;
035            }
036    
037            @Override
038            public <T> T accept(FilterVisitor<T> filterVisitor) {
039                    return filterVisitor.visit(this);
040            }
041    
042            public GeoDistance getLowerBoundGeoDistance() {
043                    return _lowerBoundGeoDistance;
044            }
045    
046            public GeoLocationPoint getPinGeoLocationPoint() {
047                    return _pinGeoLocationPoint;
048            }
049    
050            @Override
051            public int getSortOrder() {
052                    return 110;
053            }
054    
055            public GeoDistance getUpperBoundGeoDistance() {
056                    return _upperBoundGeoDistance;
057            }
058    
059            private final GeoDistance _lowerBoundGeoDistance;
060            private final GeoLocationPoint _pinGeoLocationPoint;
061            private final GeoDistance _upperBoundGeoDistance;
062    
063    }