This is a work in progress. Here are a few ideas:
I think this can all be accomplished via a few things:
For the case where the field is a polygon and the user supplies a point, we need a new FieldType, PolygonType.
I would propose the following format: vertices are separated by semi-colons, points are separated by commas just as they are for the other capabilities, i.e.: 1.0,1.0;0.0,0.0;3.0,3.0 gives the vertices <1.0,1.0> <0,0>, <3, 3>. Lines are assumed between each point. See the java.awt.Polygon class
Next, I think we can cover everything else through some function queries:
For case one above
pip(pt, dimension, boost) -- pt can be a PointType or a Vector. Boost says how much score to give if a point is in a polygon
pipll(latlonPt, boost) -- Use spherical calculations to determine if the lat lon point is in the polygon, as it is laid on a sphere
For case two above, the user would pass in a polygon as defined above for the PolygonType. In this case, we still need a function query:
pip(poly, boost) -- poly is the passed in polygon, boost is the value to give if the point is in a polygon
For PointType, we can just use capabilities of java.awt.Polygon, for lat lon, I'm still investigating. It could be we still use Polygon, but maybe we can just scale it a little bit bigger and live with some error. Otherwise, there seems to be some decent algorithms for doing it w/ lat/lon (http://msdn.microsoft.com/en-us/library/cc451895.aspx for one). Not sure that one is practical at scale, but it could be a start.
While we are at it, it shouldn't be that hard to do the same for lines, i.e. is the point on a line.