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 bce3940 commit 3b660af
Showing 1 changed file with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
* @author Luca Garulli (l.garulli--at--orientechnologies.com)
*/
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 @@ -120,7 +120,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 3b660af

Please sign in to comment.