private boolean isDefaultSearchIndex() { if (!(graph instanceof GraphBaseWithSearchIndex)) { return false; } GraphBaseWithSearchIndex graphBaseWithSearchIndex = (GraphBaseWithSearchIndex) graph; return graphBaseWithSearchIndex.getSearchIndex() instanceof DefaultSearchIndex; }
private boolean isDefaultSearchIndex() { if (!(graph instanceof GraphBaseWithSearchIndex)) { return false; } GraphBaseWithSearchIndex graphBaseWithSearchIndex = (GraphBaseWithSearchIndex) graph; return graphBaseWithSearchIndex.getSearchIndex() instanceof DefaultSearchIndex; }
@Override public SearchIndexSecurityGranularity getSearchIndexSecurityGranularity() { return getSearchIndex().getSearchIndexSecurityGranularity(); } }
@Override public void flush() { if (getSearchIndex() != null) { this.searchIndex.flush(); } }
@Override public SearchIndexSecurityGranularity getSearchIndexSecurityGranularity() { return getSearchIndex().getSearchIndexSecurityGranularity(); } }
@Override public GraphQuery query(String queryString, Authorizations authorizations) { return getSearchIndex().queryGraph(this, queryString, authorizations); }
@Override public void flush() { if (getSearchIndex() != null) { this.searchIndex.flush(); } }
@Override public GraphQuery query(Authorizations authorizations) { return getSearchIndex().queryGraph(this, null, authorizations); }
@Override public boolean isFieldBoostSupported() { return getSearchIndex().isFieldBoostSupported(); }
@Override public GraphQuery query(String queryString, Authorizations authorizations) { return getSearchIndex().queryGraph(this, queryString, authorizations); }
@Override public GraphQuery query(Authorizations authorizations) { return getSearchIndex().queryGraph(this, null, authorizations); }
@Override public boolean isFieldBoostSupported() { return getSearchIndex().isFieldBoostSupported(); }
@Override public void shutdown() { flush(); if (getSearchIndex() != null) { this.searchIndex.shutdown(); this.searchIndex = null; } }
protected void setupPropertyDefinition(PropertyDefinition propertyDefinition) { try { getSearchIndex().addPropertyDefinition(propertyDefinition); } catch (IOException e) { throw new SecureGraphException("Could not add property definition to search index", e); } }
@Override public void shutdown() { flush(); if (getSearchIndex() != null) { this.searchIndex.shutdown(); this.searchIndex = null; } }
protected void setupPropertyDefinition(PropertyDefinition propertyDefinition) { try { getSearchIndex().addPropertyDefinition(propertyDefinition); } catch (IOException e) { throw new SecureGraphException("Could not add property definition to search index", e); } }
@Override public PropertyDefinition define() { PropertyDefinition propertyDefinition = super.define(); try { getSearchIndex().addPropertyDefinition(propertyDefinition); } catch (IOException e) { throw new SecureGraphException("Could not add property definition to search index", e); } setMetadata(METADATA_DEFINE_PROPERTY_PREFIX + propertyName, propertyDefinition); return propertyDefinition; } };
@Override public PropertyDefinition define() { PropertyDefinition propertyDefinition = super.define(); try { getSearchIndex().addPropertyDefinition(propertyDefinition); } catch (IOException e) { throw new SecureGraphException("Could not add property definition to search index", e); } setMetadata(METADATA_DEFINE_PROPERTY_PREFIX + propertyName, propertyDefinition); return propertyDefinition; } };
@Test public void testAddMultipleVertices() { List<ElementBuilder<Vertex>> elements = new ArrayList<>(); elements.add(graph.prepareVertex("v1", VISIBILITY_A) .setProperty("prop1", "v1", VISIBILITY_A)); elements.add(graph.prepareVertex("v2", VISIBILITY_A) .setProperty("prop1", "v2", VISIBILITY_A)); Iterable<Vertex> vertices = graph.addVertices(elements, AUTHORIZATIONS_A_AND_B); assertVertexIds(vertices, new String[]{"v1", "v2"}); if (graph instanceof GraphBaseWithSearchIndex) { ((GraphBaseWithSearchIndex) graph).getSearchIndex().addElements(graph, vertices, AUTHORIZATIONS_A_AND_B); } }
@Test public void testAddMultipleVertices() { List<ElementBuilder<Vertex>> elements = new ArrayList<>(); elements.add(graph.prepareVertex("v1", VISIBILITY_A) .setProperty("prop1", "v1", VISIBILITY_A)); elements.add(graph.prepareVertex("v2", VISIBILITY_A) .setProperty("prop1", "v2", VISIBILITY_A)); Iterable<Vertex> vertices = graph.addVertices(elements, AUTHORIZATIONS_A_AND_B); assertVertexIds(vertices, new String[]{"v1", "v2"}); if (graph instanceof GraphBaseWithSearchIndex) { ((GraphBaseWithSearchIndex) graph).getSearchIndex().addElements(graph, vertices, AUTHORIZATIONS_A_AND_B); } }