1
0
Fork 0

renamed GeoIndex2 to GeoIndex

This commit is contained in:
jsteemann 2016-08-29 13:02:07 +02:00
parent 8fac72e8d6
commit b9f8709104
11 changed files with 62 additions and 66 deletions

View File

@ -73,7 +73,7 @@ int np4[4]={2838,5116,5180,9869};
int hs4[4]={33972992,9770664,11661062,28398735};
int hs5[4]={79685116,67516870,19274248,35037618};
static GeoIndex * gi;
static GeoIdx * gi;
static GeoCursor * gcr;
static GeoCoordinate gcp;
static GeoCoordinate gcp1, gcp2, gcp3, gcp4;
@ -87,7 +87,7 @@ static void* nullp = 0;
// --SECTION-- private functions
// -----------------------------------------------------------------------------
static void MyFree (GeoIndex * gi) {
static void MyFree (GeoIdx * gi) {
int x;
x=GeoIndex_INDEXVALID(gi);

View File

@ -42,7 +42,7 @@
#include "FulltextIndex/fulltext-query.h"
#include "FulltextIndex/fulltext-result.h"
#include "Indexes/FulltextIndex.h"
#include "Indexes/GeoIndex2.h"
#include "Indexes/GeoIndex.h"
#include "Indexes/Index.h"
#include "Random/UniformCharacter.h"
#include "Ssl/SslInterface.h"
@ -690,7 +690,7 @@ static AqlValue MergeParameters(arangodb::aql::Query* query,
}
/// @brief Load geoindex for collection name
static arangodb::GeoIndex2* getGeoIndex(
static arangodb::GeoIndex* getGeoIndex(
arangodb::AqlTransaction* trx, TRI_voc_cid_t const& cid,
std::string const& collectionName) {
// NOTE:
@ -707,12 +707,12 @@ static arangodb::GeoIndex2* getGeoIndex(
"'%s'", collectionName.c_str());
}
arangodb::GeoIndex2* index = nullptr;
arangodb::GeoIndex* index = nullptr;
for (auto const& idx : document->getIndexes()) {
if (idx->type() == arangodb::Index::TRI_IDX_TYPE_GEO1_INDEX ||
idx->type() == arangodb::Index::TRI_IDX_TYPE_GEO2_INDEX) {
index = static_cast<arangodb::GeoIndex2*>(idx.get());
index = static_cast<arangodb::GeoIndex*>(idx.get());
break;
}
}
@ -2230,7 +2230,7 @@ AqlValue Functions::Near(arangodb::aql::Query* query,
}
TRI_voc_cid_t cid = trx->resolver()->getCollectionIdLocal(collectionName);
arangodb::GeoIndex2* index = getGeoIndex(trx, cid, collectionName);
arangodb::GeoIndex* index = getGeoIndex(trx, cid, collectionName);
TRI_ASSERT(index != nullptr);
TRI_ASSERT(trx->hasDitch(cid));
@ -2281,7 +2281,7 @@ AqlValue Functions::Within(arangodb::aql::Query* query,
}
TRI_voc_cid_t cid = trx->resolver()->getCollectionIdLocal(collectionName);
arangodb::GeoIndex2* index = getGeoIndex(trx, cid, collectionName);
arangodb::GeoIndex* index = getGeoIndex(trx, cid, collectionName);
TRI_ASSERT(index != nullptr);
TRI_ASSERT(trx->hasDitch(cid));

View File

@ -202,7 +202,7 @@ add_executable(${BIN_ARANGOD}
GeoIndex/GeoIndex.cpp
Indexes/EdgeIndex.cpp
Indexes/FulltextIndex.cpp
Indexes/GeoIndex2.cpp
Indexes/GeoIndex.cpp
Indexes/HashIndex.cpp
Indexes/Index.cpp
Indexes/IndexIterator.cpp

View File

@ -357,7 +357,7 @@ int GeoIndexNewPot(GeoIx* gix) {
/* GeoString values of real (latitude, longitude) */
/* points */
/* =================================================== */
GeoIndex* GeoIndex_new(void) {
GeoIdx* GeoIndex_new(void) {
GeoIx* gix;
int i, j;
double lat, lon, x, y, z;
@ -366,7 +366,7 @@ GeoIndex* GeoIndex_new(void) {
TRI_Allocate(TRI_UNKNOWN_MEM_ZONE, sizeof(GeoIx), false));
if (gix == NULL) {
return (GeoIndex*)gix;
return (GeoIdx*)gix;
}
/* try to allocate all the things we need */
@ -537,7 +537,7 @@ GeoIndex* GeoIndex_new(void) {
gix->pots[j].end = 0x1FFFFFFFFFFFFFll;
gix->pots[j].level = 1;
for (i = 0; i < GeoIndexFIXEDPOINTS; i++) gix->pots[j].maxdist[i] = 0;
return (GeoIndex*)gix;
return (GeoIdx*)gix;
}
/* =================================================== */
/* GeoIndex_free routine */
@ -546,7 +546,7 @@ GeoIndex* GeoIndex_new(void) {
/* objects that may have been pointed to by the user's */
/* data pointers are (of course) not freed by this call*/
/* =================================================== */
void GeoIndex_free(GeoIndex* gi) {
void GeoIndex_free(GeoIdx* gi) {
GeoIx* gix;
if (gi == NULL) {
@ -1047,7 +1047,7 @@ double GeoSNMD(GeoDetailedPoint* gd, GeoCoordinate* c) {
/* GeoCoordinate data (lat/longitude and data pointer) */
/* needed for the return to the caller. */
/* =================================================== */
GeoCoordinates* GeoIndex_PointsWithinRadius(GeoIndex* gi, GeoCoordinate* c,
GeoCoordinates* GeoIndex_PointsWithinRadius(GeoIdx* gi, GeoCoordinate* c,
double d) {
GeoResults* gres;
GeoCoordinates* answer;
@ -1112,7 +1112,7 @@ GeoCoordinates* GeoIndex_PointsWithinRadius(GeoIndex* gi, GeoCoordinate* c,
/* useful points onto the top of the stack for early */
/* processing. */
/* =================================================== */
GeoCoordinates* GeoIndex_NearestCountPoints(GeoIndex* gi, GeoCoordinate* c,
GeoCoordinates* GeoIndex_NearestCountPoints(GeoIdx* gi, GeoCoordinate* c,
int count) {
GeoResults* gr;
GeoDetailedPoint gd;
@ -1437,7 +1437,7 @@ void RotateRight(GeoIx* gix, int pote) {
/* balancing operation) which starts by obtaining the */
/* two new pots. . . continued below */
/* =================================================== */
int GeoIndex_insert(GeoIndex* gi, GeoCoordinate* c) {
int GeoIndex_insert(GeoIdx* gi, GeoCoordinate* c) {
int i, j, js, slot, pot, pot1, pot2;
int potx, pota, poty, potz;
int lvx, lv1, lva, lvy, lvz;
@ -1661,7 +1661,7 @@ int GeoIndex_insert(GeoIndex* gi, GeoCoordinate* c) {
/* releasing of two pots (which are put back into the */
/* free chain using GeoIndexFreePot) Continued . . . . */
/* =================================================== */
int GeoIndex_remove(GeoIndex* gi, GeoCoordinate* c) {
int GeoIndex_remove(GeoIdx* gi, GeoCoordinate* c) {
GeoDetailedPoint gd;
int rebalance;
int lev, levp, levb, levn, levc;
@ -1979,7 +1979,7 @@ void GeoIndex_CoordinatesFree(GeoCoordinates* clist) {
/* GeoIndex_hint does nothing! */
/* it is here for possible future compatibilty */
/* =================================================== */
int GeoIndex_hint(GeoIndex* gi, int hint) { return 0; }
int GeoIndex_hint(GeoIdx* gi, int hint) { return 0; }
/* =================================================== */
/* GeoCr structure */
@ -2034,7 +2034,7 @@ GeoFix makedist(GeoPot* pot, GeoDetailedPoint* gd) {
return dist;
}
GeoCursor* GeoIndex_NewCursor(GeoIndex* gi, GeoCoordinate* c) {
GeoCursor* GeoIndex_NewCursor(GeoIdx* gi, GeoCoordinate* c) {
GeoIx* gix;
hpot hp;
if (c->longitude < -180.0) return nullptr;
@ -2194,7 +2194,7 @@ void RecursivePotDump(GeoIx* gix, FILE* f, int pot) {
}
}
void GeoIndex_INDEXDUMP(GeoIndex* gi, FILE* f) {
void GeoIndex_INDEXDUMP(GeoIdx* gi, FILE* f) {
GeoIx* gix;
gix = (GeoIx*)gi;
fprintf(f, "Dump of entire index. %d pots and %d slots allocated\n",
@ -2258,7 +2258,7 @@ int RecursivePotValidate(GeoIx* gix, int pot, int* usage) {
}
}
int GeoIndex_INDEXVALID(GeoIndex* gi) {
int GeoIndex_INDEXVALID(GeoIdx* gi) {
int usage[2]; // pots and slots
int j, pot, slot;
GeoIx* gix;

View File

@ -21,7 +21,7 @@
/// @author R. A. Parker
////////////////////////////////////////////////////////////////////////////////
/* GeoIndex.h - header file for GeoIndex algorithms */
/* GeoIdx.h - header file for GeoIdx algorithms */
/* Version 2.2 25.11.2015 R. A. Parker */
#ifndef ARANGOD_GEO_INDEX_GEO_INDEX_H
@ -85,30 +85,30 @@ typedef struct {
double* distances;
} GeoCoordinates;
typedef void GeoIndex; /* to keep the structure private */
typedef void GeoIdx; /* to keep the structure private */
typedef void GeoCursor; /* to keep the structure private */
size_t GeoIndex_MemoryUsage(void*);
GeoIndex* GeoIndex_new(void);
void GeoIndex_free(GeoIndex* gi);
GeoIdx* GeoIndex_new(void);
void GeoIndex_free(GeoIdx* gi);
double GeoIndex_distance(GeoCoordinate* c1, GeoCoordinate* c2);
int GeoIndex_insert(GeoIndex* gi, GeoCoordinate* c);
int GeoIndex_remove(GeoIndex* gi, GeoCoordinate* c);
int GeoIndex_hint(GeoIndex* gi, int hint);
GeoCoordinates* GeoIndex_PointsWithinRadius(GeoIndex* gi, GeoCoordinate* c,
int GeoIndex_insert(GeoIdx* gi, GeoCoordinate* c);
int GeoIndex_remove(GeoIdx* gi, GeoCoordinate* c);
int GeoIndex_hint(GeoIdx* gi, int hint);
GeoCoordinates* GeoIndex_PointsWithinRadius(GeoIdx* gi, GeoCoordinate* c,
double d);
GeoCoordinates* GeoIndex_NearestCountPoints(GeoIndex* gi, GeoCoordinate* c,
GeoCoordinates* GeoIndex_NearestCountPoints(GeoIdx* gi, GeoCoordinate* c,
int count);
GeoCursor* GeoIndex_NewCursor(GeoIndex* gi, GeoCoordinate* c);
GeoCursor* GeoIndex_NewCursor(GeoIdx* gi, GeoCoordinate* c);
GeoCoordinates* GeoIndex_ReadCursor(GeoCursor* gc, int count);
void GeoIndex_CursorFree(GeoCursor* gc);
void GeoIndex_CoordinatesFree(GeoCoordinates* clist);
#ifdef TRI_GEO_DEBUG
void GeoIndex_INDEXDUMP(GeoIndex* gi, FILE* f);
int GeoIndex_INDEXVALID(GeoIndex* gi);
void GeoIndex_INDEXDUMP(GeoIdx* gi, FILE* f);
int GeoIndex_INDEXVALID(GeoIdx* gi);
#endif
#endif
/* end of GeoIndex.h */
/* end of GeoIdx.h */

View File

@ -21,7 +21,7 @@
/// @author Dr. Frank Celler
////////////////////////////////////////////////////////////////////////////////
#include "GeoIndex2.h"
#include "GeoIndex.h"
#include "Logger/Logger.h"
#include "Basics/StringRef.h"
#include "VocBase/collection.h"
@ -34,7 +34,7 @@ using namespace arangodb;
/// Lat and Lon are stored in the same Array
////////////////////////////////////////////////////////////////////////////////
GeoIndex2::GeoIndex2(
GeoIndex::GeoIndex(
TRI_idx_iid_t iid, arangodb::LogicalCollection* collection,
std::vector<std::vector<arangodb::basics::AttributeName>> const& fields,
std::vector<std::string> const& path, bool geoJson)
@ -57,7 +57,7 @@ GeoIndex2::GeoIndex2(
/// @brief create a new geo index, type "geo2"
////////////////////////////////////////////////////////////////////////////////
GeoIndex2::GeoIndex2(
GeoIndex::GeoIndex(
TRI_idx_iid_t iid, arangodb::LogicalCollection* collection,
std::vector<std::vector<arangodb::basics::AttributeName>> const& fields,
std::vector<std::vector<std::string>> const& paths)
@ -78,7 +78,7 @@ GeoIndex2::GeoIndex2(
/// @brief create a new geo index, type "geo2"
GeoIndex2::GeoIndex2(TRI_idx_iid_t iid, arangodb::LogicalCollection* collection,
GeoIndex::GeoIndex(TRI_idx_iid_t iid, arangodb::LogicalCollection* collection,
VPackSlice const& info)
: Index(iid, collection, info, false),
_variant(INDEX_GEO_INDIVIDUAL_LAT_LON),
@ -123,19 +123,19 @@ GeoIndex2::GeoIndex2(TRI_idx_iid_t iid, arangodb::LogicalCollection* collection,
}
}
GeoIndex2::~GeoIndex2() {
GeoIndex::~GeoIndex() {
if (_geoIndex != nullptr) {
GeoIndex_free(_geoIndex);
}
}
size_t GeoIndex2::memory() const { return GeoIndex_MemoryUsage(_geoIndex); }
size_t GeoIndex::memory() const { return GeoIndex_MemoryUsage(_geoIndex); }
////////////////////////////////////////////////////////////////////////////////
/// @brief return a JSON representation of the index
////////////////////////////////////////////////////////////////////////////////
void GeoIndex2::toVelocyPack(VPackBuilder& builder, bool withFigures) const {
void GeoIndex::toVelocyPack(VPackBuilder& builder, bool withFigures) const {
// Basic index
Index::toVelocyPack(builder, withFigures);
@ -157,7 +157,7 @@ void GeoIndex2::toVelocyPack(VPackBuilder& builder, bool withFigures) const {
}
/// @brief Test if this index matches the definition
bool GeoIndex2::matchesDefinition(VPackSlice const& info) const {
bool GeoIndex::matchesDefinition(VPackSlice const& info) const {
TRI_ASSERT(info.isObject());
#ifdef ARANGODB_ENABLE_MAINTAINER_MODE
VPackSlice typeSlice = info.get("type");
@ -222,7 +222,7 @@ bool GeoIndex2::matchesDefinition(VPackSlice const& info) const {
int GeoIndex2::insert(arangodb::Transaction*, TRI_doc_mptr_t const* doc, bool) {
int GeoIndex::insert(arangodb::Transaction*, TRI_doc_mptr_t const* doc, bool) {
TRI_ASSERT(doc != nullptr);
TRI_ASSERT(doc->vpack() != nullptr);
@ -293,7 +293,7 @@ int GeoIndex2::insert(arangodb::Transaction*, TRI_doc_mptr_t const* doc, bool) {
return TRI_ERROR_NO_ERROR;
}
int GeoIndex2::remove(arangodb::Transaction*, TRI_doc_mptr_t const* doc, bool) {
int GeoIndex::remove(arangodb::Transaction*, TRI_doc_mptr_t const* doc, bool) {
TRI_ASSERT(doc != nullptr);
TRI_ASSERT(doc->vpack() != nullptr);
@ -356,7 +356,7 @@ int GeoIndex2::remove(arangodb::Transaction*, TRI_doc_mptr_t const* doc, bool) {
return TRI_ERROR_NO_ERROR;
}
int GeoIndex2::unload() {
int GeoIndex::unload() {
// create a new, empty index
auto empty = GeoIndex_new();
@ -376,7 +376,7 @@ int GeoIndex2::unload() {
}
/// @brief looks up all points within a given radius
GeoCoordinates* GeoIndex2::withinQuery(arangodb::Transaction* trx, double lat,
GeoCoordinates* GeoIndex::withinQuery(arangodb::Transaction* trx, double lat,
double lon, double radius) const {
GeoCoordinate gc;
gc.latitude = lat;
@ -389,7 +389,7 @@ GeoCoordinates* GeoIndex2::withinQuery(arangodb::Transaction* trx, double lat,
/// @brief looks up the nearest points
////////////////////////////////////////////////////////////////////////////////
GeoCoordinates* GeoIndex2::nearQuery(arangodb::Transaction* trx, double lat,
GeoCoordinates* GeoIndex::nearQuery(arangodb::Transaction* trx, double lat,
double lon, size_t count) const {
GeoCoordinate gc;
gc.latitude = lat;

View File

@ -21,8 +21,8 @@
/// @author Dr. Frank Celler
////////////////////////////////////////////////////////////////////////////////
#ifndef ARANGOD_INDEXES_GEO_INDEX2_H
#define ARANGOD_INDEXES_GEO_INDEX2_H 1
#ifndef ARANGOD_INDEXES_GEO_INDEX_H
#define ARANGOD_INDEXES_GEO_INDEX_H 1
#include "Basics/Common.h"
#include "GeoIndex/GeoIndex.h"
@ -35,22 +35,22 @@
namespace arangodb {
class GeoIndex2 final : public Index {
class GeoIndex final : public Index {
public:
GeoIndex2() = delete;
GeoIndex() = delete;
GeoIndex2(TRI_idx_iid_t, LogicalCollection*,
GeoIndex(TRI_idx_iid_t, LogicalCollection*,
arangodb::velocypack::Slice const&);
GeoIndex2(TRI_idx_iid_t, arangodb::LogicalCollection*,
GeoIndex(TRI_idx_iid_t, arangodb::LogicalCollection*,
std::vector<std::vector<arangodb::basics::AttributeName>> const&,
std::vector<std::string> const&, bool);
GeoIndex2(TRI_idx_iid_t, arangodb::LogicalCollection*,
GeoIndex(TRI_idx_iid_t, arangodb::LogicalCollection*,
std::vector<std::vector<arangodb::basics::AttributeName>> const&,
std::vector<std::vector<std::string>> const&);
~GeoIndex2();
~GeoIndex();
public:
//////////////////////////////////////////////////////////////////////////////
@ -148,7 +148,7 @@ class GeoIndex2 final : public Index {
/// @brief the actual geo index
//////////////////////////////////////////////////////////////////////////////
GeoIndex* _geoIndex;
GeoIdx* _geoIndex;
};
}

View File

@ -26,7 +26,7 @@
#include "Aql/QueryResultV8.h"
#include "Basics/StaticStrings.h"
#include "Basics/VelocyPackHelper.h"
#include "Indexes/GeoIndex2.h"
#include "Indexes/GeoIndex.h"
#include "Utils/OperationCursor.h"
#include "Utils/SingleCollectionTransaction.h"
#include "Utils/V8TransactionContext.h"

View File

@ -30,12 +30,8 @@
#include "Cluster/ClusterMethods.h"
#include "FulltextIndex/fulltext-index.h"
#include "Indexes/EdgeIndex.h"
#include "Indexes/FulltextIndex.h"
#include "Indexes/GeoIndex2.h"
#include "Indexes/HashIndex.h"
#include "Indexes/Index.h"
#include "Indexes/PrimaryIndex.h"
#include "Indexes/SkiplistIndex.h"
#include "Utils/SingleCollectionTransaction.h"
#include "Utils/V8TransactionContext.h"
#include "V8/v8-conv.h"

View File

@ -37,7 +37,7 @@
#include "Cluster/ServerState.h"
#include "Indexes/EdgeIndex.h"
#include "Indexes/FulltextIndex.h"
#include "Indexes/GeoIndex2.h"
#include "Indexes/GeoIndex.h"
#include "Indexes/HashIndex.h"
#include "Indexes/PrimaryIndex.h"
#include "Indexes/RocksDBIndex.h"
@ -896,7 +896,7 @@ std::shared_ptr<Index> LogicalCollection::createIndex(Transaction* trx,
}
case arangodb::Index::TRI_IDX_TYPE_GEO1_INDEX:
case arangodb::Index::TRI_IDX_TYPE_GEO2_INDEX: {
newIdx.reset(new arangodb::GeoIndex2(iid, this, info));
newIdx.reset(new arangodb::GeoIndex(iid, this, info));
break;
}
case arangodb::Index::TRI_IDX_TYPE_HASH_INDEX: {
@ -992,7 +992,7 @@ int LogicalCollection::restoreIndex(Transaction* trx, VPackSlice const& info,
}
case arangodb::Index::TRI_IDX_TYPE_GEO1_INDEX:
case arangodb::Index::TRI_IDX_TYPE_GEO2_INDEX: {
newIdx = std::make_shared<arangodb::GeoIndex2>(iid, this, info);
newIdx = std::make_shared<arangodb::GeoIndex>(iid, this, info);
break;
}
case arangodb::Index::TRI_IDX_TYPE_HASH_INDEX: {
@ -2767,7 +2767,7 @@ void LogicalCollection::addIndexCoordinator(VPackSlice const& info) {
}
case arangodb::Index::TRI_IDX_TYPE_GEO1_INDEX:
case arangodb::Index::TRI_IDX_TYPE_GEO2_INDEX: {
newIdx.reset(new arangodb::GeoIndex2(info));
newIdx.reset(new arangodb::GeoIndex(info));
break;
}
case arangodb::Index::TRI_IDX_TYPE_HASH_INDEX: {

View File

@ -42,7 +42,7 @@
#include "FulltextIndex/fulltext-index.h"
#include "Indexes/EdgeIndex.h"
#include "Indexes/FulltextIndex.h"
#include "Indexes/GeoIndex2.h"
#include "Indexes/GeoIndex.h"
#include "Indexes/HashIndex.h"
#include "Indexes/PrimaryIndex.h"
#include "Indexes/SkiplistIndex.h"