Package com.orientechnologies.orient.core.index

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


    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);

    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


  @Test(dependsOnMethods = "geoSchema")
  public void checkGeoIndexes() {
    database.open("admin", "admin");

    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

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

    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 Collection<OIdentifiable> xResult = xIndex.getUnderlying().getValuesBetween(52.20472, 82.20472);
    final Collection<OIdentifiable> yResult = yIndex.getUnderlying().getValuesBetween(0.14056, 30.14056);

    xResult.retainAll(yResult);

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

    vDoc = database.load(vDoc.getIdentity());
    vDoc.field("nick", "JayM2");
    vDoc.field("nick", "JayM3");
    vDoc.save();

    OPropertyIndex index = database.getMetadata().getSchema().getClass("Profile").getProperty("nick").getIndex();

    Collection<OIdentifiable> vOldName = index.getUnderlying().get("JayM1");
    Assert.assertEquals(vOldName.size(), 0);

    Collection<OIdentifiable> vIntermediateName = index.getUnderlying().get("JayM2");
    Assert.assertEquals(vIntermediateName.size(), 0);

    Collection<OIdentifiable> vNewName = index.getUnderlying().get("JayM3");
    Assert.assertEquals(vNewName.size(), 1);

    database.close();
  }
View Full Code Here

    vDoc = database.newInstance();
    vDoc.setClassName("Profile");
    vDoc.field("nick", "Jack").field("name", "Jack").field("surname", "Bauer");
    vDoc.save();

    OPropertyIndex indexName = database.getMetadata().getSchema().getClass("Profile").getProperty("name").getIndex();

    // We must get 2 records for "nameA".
    Collection<OIdentifiable> vName1 = indexName.getUnderlying().get("Jack");
    Assert.assertEquals(vName1.size(), 2);

    // Remove this last record.
    database.delete(vDoc);

    // We must get 1 record for "nameA".
    vName1 = indexName.getUnderlying().get("Jack");
    Assert.assertEquals(vName1.size(), 1);

    database.close();
  }
View Full Code Here

    final OProperty prop = iDatabase.getMetadata().getSchema().getClass(className).getProperty(fieldName);
    if (prop == null)
      // NO PROPERTY DEFINED
      return null;

    final OPropertyIndex index = prop.getIndex();
    if (index == null || !(index.getUnderlying() instanceof OIndexFullText))
      // NO FULL TEXT INDEX
      return null;

    return index.getUnderlying().get(fieldValue);
  }
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(), type);
    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, type, iProgressListener);
    saveInternal();
    return index;
  }
View Full Code Here

  public OPropertyIndex setIndex(final OIndex iIndex) {
    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();

    index = new OPropertyIndex(getDatabase(), owner, new String[] { name });

    return index;
  }
View Full Code Here

    return index;
  }

  public OPropertyIndex setIndexInternal(final String iIndexName) {
    index = new OPropertyIndex(getDatabase(), owner, new String[] { name });
    return index;
  }
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.