本文整理汇总了Java中com.orientechnologies.orient.core.index.OIndex.get方法的典型用法代码示例。如果您正苦于以下问题:Java OIndex.get方法的具体用法?Java OIndex.get怎么用?Java OIndex.get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.orientechnologies.orient.core.index.OIndex
的用法示例。
在下文中一共展示了OIndex.get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: checkIndexUniqueness
import com.orientechnologies.orient.core.index.OIndex; //导入方法依赖的package包/类
@Override
public <T extends MeshElement> T checkIndexUniqueness(String indexName, T element, Object key) {
FramedGraph graph = Tx.getActive().getGraph();
OrientBaseGraph orientBaseGraph = unwrapCurrentGraph();
OrientVertexType vertexType = orientBaseGraph.getVertexType(element.getClass().getSimpleName());
if (vertexType != null) {
OIndex<?> index = vertexType.getClassIndex(indexName);
if (index != null) {
Object recordId = index.get(key);
if (recordId != null) {
if (recordId.equals(element.getElement().getId())) {
return null;
} else {
return (T) graph.getFramedVertexExplicit(element.getClass(), recordId);
}
}
}
}
return null;
}
示例2: executeIndexQuery
import com.orientechnologies.orient.core.index.OIndex; //导入方法依赖的package包/类
@Override
public OIndexCursor executeIndexQuery(OCommandContext iContext, OIndex<?> index, List<Object> keyParams, boolean ascSortOrder) {
OIndexCursor cursor;
Object key;
key = keyParams.get(0);
Map<String, Object> queryParams = new HashMap<String, Object>();
queryParams.put(SpatialQueryBuilderAbstract.GEO_FILTER, SpatialQueryBuilderOverlap.NAME);
queryParams.put(SpatialQueryBuilderAbstract.SHAPE, key);
long start = System.currentTimeMillis();
OLuceneAbstractResultSet indexResult = (OLuceneAbstractResultSet) index.get(queryParams);
if (indexResult == null || indexResult instanceof OIdentifiable)
cursor = new OIndexCursorSingleValue((OIdentifiable) indexResult, new OSpatialCompositeKey(keyParams));
else
cursor = new OIndexCursorCollectionValue(((Collection<OIdentifiable>) indexResult), new OSpatialCompositeKey(
keyParams));
if (indexResult != null)
indexResult.sendLookupTime(iContext, start);
return cursor;
}
示例3: results
import com.orientechnologies.orient.core.index.OIndex; //导入方法依赖的package包/类
protected LuceneResultSet results(OFromClause target, OExpression[] args, OCommandContext ctx) {
OIndex oIndex = searchForIndex(target, args);
if (oIndex != null) {
Map<String, Object> queryParams = new HashMap<String, Object>();
queryParams.put(SpatialQueryBuilderAbstract.GEO_FILTER, operator());
Object shape;
if (args[1].getValue() instanceof OJson) {
OJson json = (OJson) args[1].getValue();
ODocument doc = new ODocument().fromJSON(json.toString());
shape = doc.toMap();
} else {
shape = args[1].execute(null, ctx);
}
queryParams.put(SpatialQueryBuilderAbstract.SHAPE, shape);
return (LuceneResultSet) oIndex.get(queryParams);
}
return null;
}
示例4: execute
import com.orientechnologies.orient.core.index.OIndex; //导入方法依赖的package包/类
@Override
public Object execute(Object iThis, OIdentifiable iCurrentRecord, Object iCurrentResult, Object[] iParams,
OCommandContext iContext) {
String clazz = (String) iParams[0];
String latField = (String) iParams[1];
String lngField = (String) iParams[2];
ODatabaseDocument databaseRecord = ODatabaseRecordThreadLocal.INSTANCE.get();
Set<OIndex<?>> indexes = databaseRecord.getMetadata().getSchema().getClass(clazz).getInvolvedIndexes(latField, lngField);
for (OIndex i : indexes) {
if (OClass.INDEX_TYPE.SPATIAL.toString().equals(i.getInternal().getType())) {
List<Object> params = new ArrayList<Object>();
params.add(iParams[3]);
params.add(iParams[4]);
double distance = iParams.length > 5 ? ((Number) iParams[5]).doubleValue() : 0;
Object ret = i.get(new OSpatialCompositeKey(params).setMaxDistance(distance));
if (ret instanceof Collection) {
if (context == null)
context = new HashSet<Object>();
context.addAll((Collection<?>) ret);
}
return ret;
}
}
return null;
}
示例5: testInsertUpdateWithIndex
import com.orientechnologies.orient.core.index.OIndex; //导入方法依赖的package包/类
@Test
public void testInsertUpdateWithIndex() throws Exception {
databaseDocumentTx.getMetadata().reload();
OSchema schema = databaseDocumentTx.getMetadata().getSchema();
ODocument doc = new ODocument("City");
doc.field("name", "Rome");
databaseDocumentTx.save(doc);
OIndex idx = schema.getClass("City").getClassIndex("City.name");
Collection<?> coll = (Collection<?>) idx.get("Rome");
Assert.assertEquals(coll.size(), 1);
Assert.assertEquals(idx.getSize(), 1);
doc = databaseDocumentTx.load((ORID) coll.iterator().next());
databaseDocumentTx.delete(doc);
coll = (Collection<?>) idx.get("Rome");
Assert.assertEquals(coll.size(), 0);
Assert.assertEquals(idx.getSize(), 0);
}
示例6: testInsertUpdateTransactionWithIndex
import com.orientechnologies.orient.core.index.OIndex; //导入方法依赖的package包/类
@Test
public void testInsertUpdateTransactionWithIndex() throws Exception {
databaseDocumentTx.close();
databaseDocumentTx.open("admin", "admin");
OSchema schema = databaseDocumentTx.getMetadata().getSchema();
schema.reload();
databaseDocumentTx.begin();
ODocument doc = new ODocument("City");
doc.field("name", "Rome");
databaseDocumentTx.save(doc);
OIndex idx = schema.getClass("City").getClassIndex("City.name");
Assert.assertNotNull(idx);
Collection<?> coll = (Collection<?>) idx.get("Rome");
Assert.assertEquals(coll.size(), 1);
databaseDocumentTx.rollback();
coll = (Collection<?>) idx.get("Rome");
Assert.assertEquals(coll.size(), 0);
databaseDocumentTx.begin();
doc = new ODocument("City");
doc.field("name", "Rome");
databaseDocumentTx.save(doc);
databaseDocumentTx.commit();
coll = (Collection<?>) idx.get("Rome");
Assert.assertEquals(coll.size(), 1);
}
示例7: testInsertUpdateTransactionWithIndex
import com.orientechnologies.orient.core.index.OIndex; //导入方法依赖的package包/类
@Test
public void testInsertUpdateTransactionWithIndex() throws Exception {
databaseDocumentTx.close();
databaseDocumentTx.open("admin", "admin");
OSchema schema = databaseDocumentTx.getMetadata().getSchema();
schema.reload();
ODocument doc = new ODocument("City");
doc.field("name", "");
ODocument doc1 = new ODocument("City");
doc1.field("name", "");
doc = databaseDocumentTx.save(doc);
doc1 = databaseDocumentTx.save(doc1);
doc = databaseDocumentTx.load(doc);
doc1 = databaseDocumentTx.load(doc1);
doc.field("name", "Rome");
doc1.field("name", "Rome");
databaseDocumentTx.save(doc);
databaseDocumentTx.save(doc1);
OIndex idx = schema.getClass("City").getClassIndex("City.name");
Collection<?> coll = (Collection<?>) idx.get("Rome");
Assert.assertEquals(coll.size(), 2);
Assert.assertEquals(idx.getSize(), 2);
}
开发者ID:orientechnologies,项目名称:orientdb-lucene,代码行数:26,代码来源:LuceneInsertUpdateSingleDocumentNoTxTest.java
示例8: getRecordByUUIDStr
import com.orientechnologies.orient.core.index.OIndex; //导入方法依赖的package包/类
public ODocument getRecordByUUIDStr(String id, String orientClass)
throws ObjectNotFoundException, NdexException {
//try {
OIndex<?> Idx;
OIdentifiable record = null;
Idx = this.db.getMetadata().getIndexManager().getIndex(NdexClasses.Index_UUID);
OIdentifiable temp = (OIdentifiable) Idx.get(id);
if((temp != null) )
record = temp;
if(record == null || ( orientClass !=null && !((ODocument)record.getRecord()).getClassName().equals(orientClass)))
throw new ObjectNotFoundException("[Class "+ orientClass + "] Object with ID: " + id.toString() + " doesn't exist.");
return (ODocument) record.getRecord();
// }
/*catch (Exception e) {
logger.severe("Unexpected error on external object retrieval by UUID : " + e.getMessage());
e.printStackTrace();
throw new NdexException(e.getMessage());
} */
}
示例9: lookupInIndex
import com.orientechnologies.orient.core.index.OIndex; //导入方法依赖的package包/类
private Stream<OIdentifiable> lookupInIndex(OIndex<Object> index, Object value) {
Object fromIndex = index.get(value);
if (fromIndex instanceof Iterable)
return StreamUtils.asStream(((Iterable<OIdentifiable>) fromIndex).iterator());
else
return Stream.of((OIdentifiable) fromIndex);
}
示例10: get
import com.orientechnologies.orient.core.index.OIndex; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public IGraphIterable<IGraphEdge> get(String key, Object valueExpr) {
valueExpr = normalizeValue(valueExpr);
final OIndex<?> idx = getIndexManager().getIndex(getSBTreeIndexName(valueExpr.getClass()));
if (idx == null) {
return new EmptyIGraphIterable<>();
}
final Collection<OIdentifiable> resultSet = (Collection<OIdentifiable>) idx.get(valueExpr);
return new ResultSetIterable<>(resultSet, graph, IGraphEdge.class);
}
示例11: get
import com.orientechnologies.orient.core.index.OIndex; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public IGraphIterable<IGraphNode> get(final String key, Object valueExpr) {
valueExpr = normalizeValue(valueExpr);
final OIndex<?> idx = getIndex(valueExpr.getClass());
if (idx == null) {
return new EmptyIGraphIterable<>();
}
final Collection<OIdentifiable> resultSet = (Collection<OIdentifiable>) idx.get(new OCompositeKey(key, valueExpr));
return new ResultSetIterable<>(resultSet, graph, IGraphNode.class);
}
示例12: executeIndexQuery
import com.orientechnologies.orient.core.index.OIndex; //导入方法依赖的package包/类
@Override
public OIndexCursor executeIndexQuery(OCommandContext iContext, OIndex<?> index, List<Object> keyParams, boolean ascSortOrder) {
OIndexCursor cursor;
Object indexResult = index.get(new OFullTextCompositeKey(keyParams).setContext(iContext));
if (indexResult == null || indexResult instanceof OIdentifiable)
cursor = new OIndexCursorSingleValue((OIdentifiable) indexResult, new OFullTextCompositeKey(keyParams));
else
cursor = new OIndexCursorCollectionValue(((Collection<OIdentifiable>) indexResult).iterator(), new OFullTextCompositeKey(
keyParams));
iContext.setVariable("$luceneIndex", true);
return cursor;
}
示例13: testInsertUpdateWithIndex
import com.orientechnologies.orient.core.index.OIndex; //导入方法依赖的package包/类
@Test
public void testInsertUpdateWithIndex() throws Exception {
OSchema schema = databaseDocumentTx.getMetadata().getSchema();
ODocument doc = new ODocument("City");
doc.field("name", "Rome");
databaseDocumentTx.save(doc);
OIndex idx = schema.getClass("City").getClassIndex("City.name");
Collection<?> coll = (Collection<?>) idx.get("Rome");
Assert.assertEquals(coll.size(), 1);
doc = databaseDocumentTx.load((ORID) coll.iterator().next());
Assert.assertEquals(doc.field("name"), "Rome");
doc.field("name", "London");
databaseDocumentTx.save(doc);
coll = (Collection<?>) idx.get("Rome");
Assert.assertEquals(coll.size(), 0);
coll = (Collection<?>) idx.get("London");
Assert.assertEquals(coll.size(), 1);
doc = databaseDocumentTx.load((ORID) coll.iterator().next());
Assert.assertEquals(doc.field("name"), "London");
doc.field("name", "Berlin");
databaseDocumentTx.save(doc);
coll = (Collection<?>) idx.get("Rome");
Assert.assertEquals(coll.size(), 0);
coll = (Collection<?>) idx.get("London");
Assert.assertEquals(coll.size(), 0);
coll = (Collection<?>) idx.get("Berlin");
Assert.assertEquals(coll.size(), 1);
}
示例14: testInsertUpdateTransactionWithIndex
import com.orientechnologies.orient.core.index.OIndex; //导入方法依赖的package包/类
@Test
public void testInsertUpdateTransactionWithIndex() throws Exception {
databaseDocumentTx.close();
databaseDocumentTx.open("admin", "admin");
OSchema schema = databaseDocumentTx.getMetadata().getSchema();
schema.reload();
databaseDocumentTx.begin();
ODocument doc = new ODocument("City");
doc.field("name", "");
ODocument doc1 = new ODocument("City");
doc1.field("name", "");
doc = databaseDocumentTx.save(doc);
doc1 = databaseDocumentTx.save(doc1);
databaseDocumentTx.commit();
databaseDocumentTx.begin();
doc = databaseDocumentTx.load(doc);
doc1 = databaseDocumentTx.load(doc1);
doc.field("name", "Rome");
doc1.field("name", "Rome");
databaseDocumentTx.save(doc);
databaseDocumentTx.save(doc1);
databaseDocumentTx.commit();
OIndex idx = schema.getClass("City").getClassIndex("City.name");
Collection<?> coll = (Collection<?>) idx.get("Rome");
Assert.assertEquals(coll.size(), 2);
Assert.assertEquals(idx.getSize(), 2);
}
开发者ID:orientechnologies,项目名称:orientdb-lucene,代码行数:29,代码来源:LuceneInsertUpdateSingleDocumentTransactionTest.java
示例15: getRecordByUUIDStr
import com.orientechnologies.orient.core.index.OIndex; //导入方法依赖的package包/类
protected ODocument getRecordByUUIDStr(String id)
throws ObjectNotFoundException, NdexException {
OIndex<?> Idx;
OIdentifiable record = null;
Idx = this.localConnection.getMetadata().getIndexManager().getIndex(NdexClasses.Index_UUID);
OIdentifiable temp = (OIdentifiable) Idx.get(id);
if((temp != null) )
record = temp;
else
throw new ObjectNotFoundException("Network with ID: " + id + " doesn't exist.");
return (ODocument) record.getRecord();
}