Question

I want to get my value of the field ‘Latitude’ and ‘Longitude’ into a variable in order to pass it as an argument in below function:

// add a filterquery to find products in a range of 25km, using the helper to generate the 'geofilt' filter

$query->createFilterQuery('city')->setQuery($helper->geofilt(doubleval('latitude'),doubleval('longitude'),'geo',25));

//Sort the results by location

$query->addSort(($helper->geodist('geo','latitude','longitude')), Solarium_Query_Select::SORT_ASC);

This is not giving me any results and passing the pt=0,0 as shown below:

fq={!geofilt+pt%3D0,0+sfield%3Dgeo+d%3D25}

So how can i get the field values of ‘latitude’ and ‘longitude’ in geofilt() So that i can get results and value with in that 'latitude' and 'longitude' ?

Was it helpful?

Solution

Normally you would not use field values as the second and third argument in the geodist call. The first parameter is the location field to use, the second and third are the lat / long to compare this to. This is usually based on search input.

If you use field values for this, you are basically comparing the distance between values within document itself. I don't even know if Solr supports that.

Can you manually create a Solr query that returns the results you need? I can probably 'translate' that to Solarium calls.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top