Skip to content

Commit

Permalink
Add support for multiple labels in shortestPath() function
Browse files Browse the repository at this point in the history
Resolves: #7842
  • Loading branch information
luigidellaquila committed Oct 23, 2017
1 parent b549752 commit 815ca3c
Showing 1 changed file with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
*/
@Deprecated
public class OSQLFunctionShortestPath extends OSQLFunctionMathAbstract {
public static final String NAME = "shortestPath";
public static final String NAME = "shortestPath";
public static final String PARAM_MAX_DEPTH = "maxDepth";

protected static final float DISTANCE = 1f;
Expand Down Expand Up @@ -123,7 +123,16 @@ public List<ORID> call(final OrientBaseGraph graph) {
if (iParams.length > 3) {
ctx.edgeType = iParams[3] == null ? null : "" + iParams[3];
}
ctx.edgeTypeParam = new String[] { ctx.edgeType };
if (iParams != null && iParams.length > 2 && iParams[3] instanceof Collection) {
ctx.edgeTypeParam = new String[((Collection) iParams[3]).size()];
Collection coll = (Collection) iParams[3];
int i = 0;
for (Object o : coll) {
ctx.edgeTypeParam[i++] = "" + o;
}
} else {
ctx.edgeTypeParam = new String[] { ctx.edgeType };
}

if (iParams.length > 4) {
bindAdditionalParams(iParams[4], ctx);
Expand Down

0 comments on commit 815ca3c

Please sign in to comment.