/** * Create a sequence of nodes that iterates over the supplied nodes. Note that the supplied iterator is accessed lazily as the * resulting sequence's {@link #nextBatch() first batch} is {@link Batch#nextRow() used}. * * @param nodes the iterator over the nodes to be returned; if null, an {@link #emptySequence empty instance} is returned * @param score the score to return for all of the nodes * @param workspaceName the name of the workspace in which all of the nodes exist * @return the sequence of nodes; never null */ public static NodeSequence withNodes( final Collection<CachedNode> nodes, final float score, final String workspaceName ) { if (nodes == null || nodes.isEmpty()) return emptySequence(1); return withNodes(nodes.iterator(), nodes.size(), score, workspaceName); }
/** * Create a sequence of nodes that iterates over the supplied nodes. Note that the supplied iterator is accessed lazily as the * resulting sequence's {@link #nextBatch() first batch} is {@link Batch#nextRow() used}. * * @param nodes the iterator over the nodes to be returned; if null, an {@link #emptySequence empty instance} is returned * @param score the score to return for all of the nodes * @param workspaceName the name of the workspace in which all of the nodes exist * @return the sequence of nodes; never null */ public static NodeSequence withNodes( final Collection<CachedNode> nodes, final float score, final String workspaceName ) { if (nodes == null || nodes.isEmpty()) return emptySequence(1); return withNodes(nodes.iterator(), nodes.size(), score, workspaceName); }
/** * Obtain a {@link NodeSequence} that returns the (queryable) node at the given path in the workspace, where the node is * assigned the given score. * * @param path the path of the node; may not be null * @param score the score for the node * @return the sequence of node(s); never null */ public NodeSequence singleNode( Path path, float score ) { String workspaceName = getWorkspaceName(path); // Get the node filter to use ... NodeFilter nodeFilter = nodeFilterForWorkspace(workspaceName); if (nodeFilter != null) { // Find the node by path ... NodeCache cache = repo.getWorkspaceCache(workspaceName); CachedNode node = getNodeAtPath(path, cache); if (node != null && nodeFilter.includeNode(node, cache)) { return NodeSequence.withNodes(Collections.singleton(node), score, workspaceName); } } return NodeSequence.emptySequence(1); }
/** * Obtain a {@link NodeSequence} that returns the (queryable) node at the given path in the workspace, where the node is * assigned the given score. * * @param path the path of the node; may not be null * @param score the score for the node * @return the sequence of node(s); never null */ public NodeSequence singleNode( Path path, float score ) { String workspaceName = getWorkspaceName(path); // Get the node filter to use ... NodeFilter nodeFilter = nodeFilterForWorkspace(workspaceName); if (nodeFilter != null) { // Find the node by path ... NodeCache cache = repo.getWorkspaceCache(workspaceName); CachedNode node = getNodeAtPath(path, cache); if (node != null && nodeFilter.includeNode(node, cache)) { return NodeSequence.withNodes(Collections.singleton(node), score, workspaceName); } } return NodeSequence.emptySequence(1); }
CachedNode node = cache.getNode(key); if (node != null && nodeFilter.includeNode(node, cache)) { return NodeSequence.withNodes(Collections.singleton(node), score, workspaceName); CachedNode node = cache.getNode(key); if (node != null && nodeFilter.includeNode(node, cache)) { return NodeSequence.withNodes(Collections.singleton(node), score, workspaceName);
CachedNode node = cache.getNode(key); if (node != null && nodeFilter.includeNode(node, cache)) { return NodeSequence.withNodes(Collections.singleton(node), score, workspaceName); CachedNode node = cache.getNode(key); if (node != null && nodeFilter.includeNode(node, cache)) { return NodeSequence.withNodes(Collections.singleton(node), score, workspaceName);
return NodeSequence.withNodes(results, score, workspaceName);
return NodeSequence.withNodes(results, score, workspaceName);