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().getIndexManager().load();

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

    xResult.retainAll(yResult);

    Assert.assertTrue(xResult.size() != 0);
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

      if (document.field("index-type") == null) {
        final OIndex underlyingIndex = document.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");
      } else {
        // @COMPATIBILITY 0.9.24
        ODocument cfg = new ODocument(document.getDatabase());
        cfg.field(OIndex.CONFIG_TYPE, (String) document.field("index-type"));
        index = new OPropertyIndex(document.getDatabase(), owner, new String[] { name }, cfg);
      }
    }
  }
View Full Code Here

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

    index = new OPropertyIndex(document.getDatabase(), owner, new String[] { name }, iType, iProgressListener);
    return index;
  }

  public OPropertyIndex setIndex(final OIndex iIndex) {
    index = new OPropertyIndex(iIndex, new String[] { name });
    return index;
  }
View Full Code Here

    index = new OPropertyIndex(iIndex, new String[] { name });
    return index;
  }

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

    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

  @Test(dependsOnMethods = "geoSchema")
  public void checkGeoIndexes() {
    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);

    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.