apache / apache/lucene

Add makeShapeValueSource to SpatialStrategy [LUCENE-5804]

Open
#6,866 0 comments 0 reactions 0 assignees View on GitHub
legacy-jira-priority:Major module:spatial type:enhancement
Dominant language
Java
Stars
3.6k
Forks
1.4k
Avg merge
2d 11h
Merged PRs (30d)
88

Description

The notion of a ValueSource that yields a Shape from FunctionValues.objectVal(docId) was introduced with SerializedDVStrategy, and I rather like it. I think the base SpatialStrategy abstraction should be amended with it. In addition, a marker class "ShapeValueSource" that simply extends ValueSource would clarify when/where these special value sources are used with a bit of type safety.

```java
/**
* Provides access to a Shape per document via ValueSource in which
* {`@link` org.apache.lucene.queries.function.FunctionValues#objectVal(int)} returns a {`@link`
* Shape}.
*/
public ShapeValueSource makeShapeValueSource() {
throw new UnsupportedOperationException();
}

//(use existing javadocs)
public ValueSource makeDistanceValueSource(Point queryPoint, double multiplier) {

return new DistanceToShapeValueSource(makeShapeValueSource(), queryPoint, multiplier, ctx);
}
```

SerializedDVStrategy & BBoxStrategy would use this; PointVectorStrategy could be modified to.

---
Migrated from [LUCENE-5804](https://issues.apache.org/jira/browse/LUCENE-5804) by David Smiley (@dsmiley)

Contributor guide

Open the contributing guide

Research direction

Start by reading SpatialStrategy and the existing SerializedDVStrategy, BBoxStrategy, and PointVectorStrategy implementations named in the issue. Trace how their ValueSource objects expose shapes, then add the shared ShapeValueSource abstraction and adapt the applicable strategies. Done means the requested API exists and the named strategies use it without changing their spatial behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
search
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.