-
Type: Bug
-
Resolution: Done
-
Priority: Major - P3
-
Affects Version/s: 2.4.1
-
Component/s: Geo, Querying, Text Search
-
None
-
ALL
If the text command is passed a filter with a $near query operator, the result set will include items that don't match the filter. $near needs to be resolved using a geospatial index, and I assume that the matcher currently does not use the index here.
The expected behavior would be for the search to resolve correctly using both indexes, or to just fail explicitly as unsupported.
To reproduce:
db.generated.ensureIndex({"location.coordinates":"2d"}) db.generated.ensureIndex({t:"text"}) db.generated.insert({t:"bike",location:{coordinates:[40,7.25]}}) // evaluates to 1: db.generated.find({"location.coordinates": { $near: [40,7.25], $maxDistance: 0.01 }}).count() // evaluates to 0: db.generated.find({"location.coordinates": { $near: [-40,7.25], $maxDistance: 0.01 }}).count() // evaluates to 1: db.generated.runCommand("text", { search: "bike", filter: { "location.coordinates": { $near: [40, 7.25], $maxDistance: 0.01 }}}).stats.n // evaluates to 1 (unexpected): db.generated.runCommand("text", { search: "bike", filter: { "location.coordinates": { $near: [-40, 7.25], $maxDistance: 0.01 }}}).stats.n
- is related to
-
SERVER-3071 Index Intersection
- Closed