classes/extendedattributefilters/ezfindgeodistextendedattributefilter.php
public function filterQueryParams( array $queryParams, array $filterParams )
    {
        try
        {
            if( !isset( $filterParams['field'] ) )
            {
                throw new Exception( 'Missing filter parameter "field"' );
            }

            if( !isset( $filterParams['latitude'] ) )
            {
                throw new Exception( 'Missing filter parameter "latitude"' );
            }

            if( !isset( $filterParams['longitude'] ) )
            {
                throw new Exception( 'Missing filter parameter "longitude"' );
            }

            $fieldName = eZSolr::getFieldName( $filterParams['field'] );

            //geodist custom parameters
            $queryParams['sfield'] = $fieldName;
            $queryParams['pt'] = $filterParams['latitude'] . ',' . $filterParams['longitude'];

            //sort by geodist
            $queryParams['sort']  = 'geodist() asc,' . $queryParams['sort'];

            //exclude unlocated documents
            $queryParams['fq'][] = $fieldName.':[-90,-90 TO 90,90]';
        }
        catch( Exception $e )
        {
            eZDebug::writeWarning( $e->getMessage(), __CLASS__ );
        }

        return $queryParams;
    }
public function filterQueryParams( array $queryParams, array $filterParams )
    {
        try
        {
            if( !isset( $filterParams['field'] ) )
            {
                throw new Exception( 'Missing filter parameter "field"' );
            }

            if( !isset( $filterParams['latitude'] ) )
            {
                throw new Exception( 'Missing filter parameter "latitude"' );
            }

            if( !isset( $filterParams['longitude'] ) )
            {
                throw new Exception( 'Missing filter parameter "longitude"' );
            }

            $fieldName = eZSolr::getFieldName( $filterParams['field'] );

            //geodist custom parameters
            $queryParams['sfield'] = $fieldName;
            $queryParams['pt'] = $filterParams['latitude'] . ',' . $filterParams['longitude'];

            //sort by geodist
            $queryParams['sort']  = 'geodist() asc,' . $queryParams['sort'];

            //exclude unlocated documents
            $queryParams['fq'][] = $fieldName.':[-90,-90 TO 90,90]';
        }
        catch( Exception $e )
        {
            eZDebug::writeWarning( $e->getMessage(), __CLASS__ );
        }

        return $queryParams;
    }
public function filterQueryParams ( array $ queryParams , array $ filterParams ) { try { if ( ! isset ( $ filterParams [ 'field' ] ) ) { throw new Exception ( 'Missing filter parameter "field"' ) ; } if ( ! isset ( $ filterParams [ 'latitude' ] ) ) { throw new Exception ( 'Missing filter parameter "latitude"' ) ; } if ( ! isset ( $ filterParams [ 'longitude' ] ) ) { throw new Exception ( 'Missing filter parameter "longitude"' ) ; } $ fieldName = eZSolr :: getFieldName ( $ filterParams [ 'field' ] ) ; //geodist custom parameters $ queryParams [ 'sfield' ] = $ fieldName ; $ queryParams [ 'pt' ] = $ filterParams [ 'latitude' ] . ',' . $ filterParams [ 'longitude' ] ; //sort by geodist $ queryParams [ 'sort' ] = 'geodist() asc,' . $ queryParams [ 'sort' ] ; //exclude unlocated documents $ queryParams [ 'fq' ] [ ] = $ fieldName . ':[-90,-90 TO 90,90]' ; } catch ( Exception $ e ) { eZDebug :: writeWarning ( $ e -> getMessage ( ) , __CLASS__ ) ; } return $ queryParams ; }
Modifies SolR query params according to filter parameters
@param array $queryParams
@param array $filterParams
@return array $queryParams
Modifies SolR query params according to filter parameters