You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently there is an overload specifically on the LuceneSearchQuery that allows passing in a Lucene Query instance to perform a search but it would also be nice to be able to provide a Lucene Filter. For example, this would mean that for Spatial searches we wouldn't have to manually execute the query: https://github.com/Shazwazza/Examine/blob/master/src/Examine.Test/Extensions/SpatialSearch.cs#L100
The text was updated successfully, but these errors were encountered:
I currently integrated spatial queries with this extension methods:
/// <summary>/// Creates a query for results near the given <paramref name="latitude" />, <paramref name="longitude" /> in a radius of <paramref name="distance" />./// </summary>/// <remarks>This requires an index of <see cref="Constants.Constants" /> to be present.</remarks>publicstaticIBooleanOperationLocation(thisIQueryquery,doublelatitude,doublelongitude,doubledistance){if(queryis not LuceneSearchQueryluceneQuery)thrownewInvalidOperationException("Location queries are only supported on Lucene queries");varspatialContext=SpatialContext.Geo;vargrid=newGeohashPrefixTree(spatialContext,11);// 11 = sub-metre precision for geohashvarstrategy=newRecursivePrefixTreeStrategy(grid,Constants.LOCATION_INDEX_FIELD);varargs=newSpatialArgs(SpatialOperation.Intersects,spatialContext.MakeCircle(longitude,latitude,DistanceUtils.Dist2Degrees(distance,DistanceUtils.EarthMeanRadiusKilometers)));varlocationQuery=strategy.MakeQuery(args);returnluceneQuery.LuceneQuery(locationQuery,BooleanOperation.And);}
I currently have the location field on the index as a constant, but it shouldn't be too hard to add a parameter for that, this way I can still treat them like normal Examine queries otherwise.
Currently there is an overload specifically on the LuceneSearchQuery that allows passing in a Lucene
Query
instance to perform a search but it would also be nice to be able to provide a Lucene Filter. For example, this would mean that for Spatial searches we wouldn't have to manually execute the query: https://github.com/Shazwazza/Examine/blob/master/src/Examine.Test/Extensions/SpatialSearch.cs#L100The text was updated successfully, but these errors were encountered: