Help with Understanding RavenDB query, I'm using following model to store & index spatial data.
public class GeoRecord {
public string SearchId {get; set;}
public string Tag {get; set;}
public double Latitude {get; set;}
public double Longitude {get; set;}
}
public class GeoRecord_GeoIndex : AbstractIndexCreationTask<GeoRecord>
{
public GeoRecord_GeoIndex()
{
Map = records => from @record in records
select new
{
IndexName = "geoIndex",
record.SearchId,
Coordinates = CreateSpatialField(@record.Latitude, @record.Longitude)
};
}
}
I can able to filter all GeoRecord's using Spatial query like below:
await session
.Query<GeoRecord, GeoRecord_GeoIndex>()
.Spatial("Coordinates", factory => factory.Within(shapeWkt: wkt))
.ToListAsync();
However I would like to filter by both SearchId & Coordinates, I got this solution however I would like to understand if it uses GeoRecord_GeoIndex rather than filtering the results from GeoRecord.
await session.Advanced.AsyncDocumentQuery<GeoRecord, GeoRecord_GeoIndex>()
.WhereIn("SearchId", activeSearchIds)
.Intersect()
.Spatial("Coordinates", criteria => criteria.Within(shapeWkt:wkt))
.ToListAsync();