I use searchkick for geoloc and it work fine, the problem is my query return me all users in the perimeter including the user who do the request.
So for the moment I have
res = User.search "*", where: {location: {near: [@user.current_position.latitude, @user.current_position.longitude], within: params[:perimeter] + "mi"}}
And I want something like that :
res = User.search "*", where: {location: {near: [@user.current_position.latitude, @user.current_position.longitude], within: params[:perimeter] + "mi"}, {:email != @user.email}}
to get only the users different than the user who do the query.
I'm not a ruby specialist so I don't find the correct syntax to do this. Any help ?
Based on the documentation for Queries, not
condition is applied as follows:
res = User.search "*", where: {
location: {
near: [ @user.current_position.latitude, @user.current_position.longitude ],
within: params[:perimeter] + "mi"
},
email: { not: @user.email }
}
Formatted code to show email: { not: @user.email }
in new line.