Package com.orientechnologies.orient.core.index

Examples of com.orientechnologies.orient.core.index.OPropertyIndex


  @Test(dependsOnMethods = "queryDistance")
  public void spatialRange() {
    database.open("admin", "admin");
    database.getMetadata().getSchema().reload();

    final OPropertyIndex xIndex = database.getMetadata().getSchema().getClass("MapPoint").getProperty("x").getIndex();
    Assert.assertNotNull(xIndex);

    final OPropertyIndex yIndex = database.getMetadata().getSchema().getClass("MapPoint").getProperty("y").getIndex();
    Assert.assertNotNull(yIndex);

    final Set<OIdentifiable> xResult = xIndex.getUnderlying().getBetween(52.20472, 82.20472);
    final Set<OIdentifiable> yResult = yIndex.getUnderlying().getBetween(0.14056, 30.14056);

    xResult.retainAll(yResult);

    Assert.assertTrue(xResult.size() != 0);
View Full Code Here


   *          <li>FULLTEXT: Indexes single word for full text search</li>
   *          </ul>
   * @return
   */
  public OPropertyIndex createIndex(final INDEX_TYPE iType) {
    index = new OPropertyIndex(getDatabase(), owner, new String[] { name }, iType.toString());
    return index;
  }
View Full Code Here

   *          <li>FULLTEXT: Indexes single word for full text search</li>
   *          </ul>
   * @return
   */
  public OPropertyIndex createIndexInternal(final String iType, final OProgressListener iProgressListener) {
    index = new OPropertyIndex(getDatabase(), owner, new String[] { name }, iType, iProgressListener);
    saveInternal();
    return index;
  }
View Full Code Here

    getDatabase().checkSecurity(ODatabaseSecurityResources.SCHEMA, ORole.PERMISSION_UPDATE);
    final String cmd = String.format("alter property %s index %s", getFullName(), iIndex.getIdentity());
    getDatabase().command(new OCommandSQL(cmd)).execute();

    final OIndex idx = getDatabase().getMetadata().getIndexManager().getIndex(iIndex.getIdentity());
    index = new OPropertyIndex(idx, new String[] { name });

    return index;
  }
View Full Code Here

    if (iIndexName.startsWith("#")) {
      idx = getDatabase().getMetadata().getIndexManager().getIndex(new ORecordId(iIndexName));
    } else {
      idx = getDatabase().getMetadata().getIndexManager().getIndex(iIndexName);
    }
    index = new OPropertyIndex(idx, new String[] { name });
    saveInternal();
    return index;
  }
View Full Code Here

      linkedType = OType.getById(((Integer) document.field("linkedType")).byteValue());

    OIndex underlyingIndex = getDatabase().getMetadata().getIndexManager().getIndex(getFullName());

    if (underlyingIndex != null)
      index = new OPropertyIndex(underlyingIndex, new String[] { name });
    else if (document.field("index") != null) {
      if (document.field("index-type") == null) {
        underlyingIndex = getDatabase().getMetadata().getIndexManager().getIndex((ORecordId) document.field("index", ORID.class));

        if (underlyingIndex != null)
          index = new OPropertyIndex(underlyingIndex, new String[] { name });
        else
          // REMOVE WRONG INDEX REF
          document.removeField("index");
      }
    }
View Full Code Here

    final OClass mapPointClass = database.getMetadata().getSchema().createClass("MapPoint");
    mapPointClass.createProperty("x", OType.DOUBLE).createIndex(INDEX_TYPE.NOTUNIQUE);
    mapPointClass.createProperty("y", OType.DOUBLE).createIndex(INDEX_TYPE.NOTUNIQUE);
    database.getMetadata().getSchema().save();

    final OPropertyIndex xIndex = database.getMetadata().getSchema().getClass("MapPoint").getProperty("x").getIndex();
    Assert.assertNotNull(xIndex);

    final OPropertyIndex yIndex = database.getMetadata().getSchema().getClass("MapPoint").getProperty("y").getIndex();
    Assert.assertNotNull(yIndex);

    database.close();
  }
View Full Code Here

TOP

Related Classes of com.orientechnologies.orient.core.index.OPropertyIndex

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.