1
0
Fork 0
This commit is contained in:
Frank Celler 2012-04-30 17:52:31 +02:00
parent 1ff5f2940a
commit 1a254e0c8e
6 changed files with 76 additions and 22 deletions

View File

@ -11,7 +11,8 @@ content-type: application/json
"f"
],
"id": "164647097/165564601",
"type": "geo",
"type": "geo2",
"constraint" : false,
"isNewlyCreated": true,
"error": false
}

View File

@ -11,7 +11,8 @@ content-type: application/json
"b"
],
"id": "161370297/162222265",
"type": "geo",
"type": "geo1",
"constraint" : false,
"isNewlyCreated": true,
"error": false
}

View File

@ -29,6 +29,11 @@
/// @page IndexGeoTOC
///
/// <ol>
/// <li>@ref IndexGeoHttp
/// <ol>
/// <li>@ref IndexGeoHttpEnsureGeo "Creating a Geo Index/Constraint POST /_api/index"</li>
/// </ol>
/// </li>
/// <li>@ref IndexGeoShell
/// <ol>
/// <li>@ref IndexGeoShellEnsureGeoIndex "collection.ensureGeoIndex"</li>
@ -38,8 +43,6 @@
/// <li>@ref IndexGeoShellWithin "collection.within"</li>
/// </ol>
/// </li>
/// <li>@ref IndexGeoHttp
/// </li>
/// </ol>
////////////////////////////////////////////////////////////////////////////////
@ -62,7 +65,14 @@
/// requirements.
///
/// A geo-spatial constraint makes the same assumptions, but documents
/// not fulfill the requirements are rejected.
/// not fulfilling these requirements are rejected.
///
/// @section IndexGeoHttp Accessing Geo Indexes via Http
////////////////////////////////////////////////////////
///
/// @anchor IndexGeoHttpEnsureGeo
/// @copydetails JSF_POST_api_index_geo
/// <hr>
///
/// @section IndexGeoShell Accessing Geo Indexes from the Shell
///////////////////////////////////////////////////////////////
@ -85,9 +95,6 @@
///
/// @anchor IndexGeoShellWithin
/// @copydetails JSF_AvocadoCollection_prototype_within
///
/// @section IndexGeoHttp Accessing Geo Indexes via Http
////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
// Local Variables:

View File

@ -226,7 +226,7 @@ static char** AttemptedCompletion (char const* text, int start, int end) {
/// @brief constructs a new editor
////////////////////////////////////////////////////////////////////////////////
V8LineEditor::V8LineEditor (v8::Handle<v8::Context> context, string const& history)
V8LineEditor::V8LineEditor (v8::Handle<v8::Context> context, std::string const& history)
: LineEditor(history), _context(context) {
}

View File

@ -4387,7 +4387,7 @@ static v8::Handle<v8::Value> JS_EnsureGeoIndexVocbaseCol (v8::Arguments const& a
/// @FUN{@FA{collection}.ensureGeoConstraint(@FA{latitude}, @FA{longitude}, @FA{ignore-null})}
///
/// Works like @FN{ensureGeoIndex} but requires that the documents contain
/// a valid geo definition. If @FA{ignore-null} is true, than documents with
/// a valid geo definition. If @FA{ignore-null} is true, then documents with
/// a null in @FA{location} or at least one null in @FA{latitude} or
/// @FA{longitude} are ignored.
////////////////////////////////////////////////////////////////////////////////
@ -4399,7 +4399,7 @@ static v8::Handle<v8::Value> JS_EnsureGeoConstraintVocbaseCol (v8::Arguments con
////////////////////////////////////////////////////////////////////////////////
/// @brief ensures that a hash index exists
///
/// @FUN{ensureUniqueConstrain(@FA{field1}, @FA{field2}, ...,@FA{fieldn})}
/// @FUN{ensureUniqueConstraint(@FA{field1}, @FA{field2}, ...,@FA{fieldn})}
///
/// Creates a hash index on all documents using attributes as paths to the
/// fields. At least one attribute must be given. The value of this attribute
@ -4978,7 +4978,7 @@ static v8::Handle<v8::Value> JS_RenameVocbaseCol (v8::Arguments const& argv) {
/// @FUN{@FA{collection}.replace(@FA{document}, @FA{data})}
///
/// Replaces an existing @FA{document}. The @FA{document} must be a document in
/// the current collection. This document is than replaced with the
/// the current collection. This document is then replaced with the
/// @FA{data} given as second argument.
///
/// The method returns a document with the attributes @LIT{_id}, @LIT{_rev} and
@ -5479,7 +5479,7 @@ static v8::Handle<v8::Value> JS_CompletionsVocBase (v8::Arguments const& argv) {
/// @FUN{db._create(@FA{collection-name})}
///
/// Creates a new collection named @FA{collection-name}. If the collection name
/// already exists, than an error is thrown. The default value for
/// already exists, then an error is thrown. The default value for
/// @LIT{waitForSync} is @LIT{false}.
///
/// @FUN{db._create(@FA{collection-name}, @FA{properties})}
@ -5754,7 +5754,7 @@ static v8::Handle<v8::Value> JS_CollectionsEdges (v8::Arguments const& argv) {
/// @FUN{edges._create(@FA{collection-name})}
///
/// Creates a new collection named @FA{collection-name}. If the collection name
/// already exists, than an error is thrown. The default value for
/// already exists, then an error is thrown. The default value for
/// @LIT{waitForSync} is @LIT{false}.
///
/// @FUN{edges._create(@FA{collection-name}, @FA{properties})}

View File

@ -154,6 +154,59 @@ function GET_api_index (req, res) {
////////////////////////////////////////////////////////////////////////////////
/// @brief creates a geo index
///
/// @REST{POST /_api/index?collection=@FA{collection-identifier}}
///
/// Creates a geo-spatial index in the collection @FA{collection-identifier}, if
/// it does not already exist. Expects an object containing the index details.
///
/// - @LIT{type}: must be equal to @LIT{"geo"}.
///
/// - @LIT{fields}: A list with one or two attribute paths. <br>
/// <br>
/// If it is a list with one attribute path @FA{location}, then a geo-spatial
/// index on all documents is created using @FA{location} as path to the
/// coordinates. The value of the attribute must be a list with at least two
/// double values. The list must contain the latitude (first value) and the
/// longitude (second value). All documents, which do not have the attribute
/// path or with value that are not suitable, are ignored.<br>
/// <br>
/// If it is a list with two attribute paths @FA{latitude} and @FA{longitude},
/// then a geo-spatial index on all documents is created using @FA{latitude}
/// and @FA{longitude} as paths the latitude and the longitude. The value of
/// the attribute @FA{latitude} and of the attribute @FA{longitude} must a
/// double. All documents, which do not have the attribute paths or which
/// values are not suitable, are ignored.
///
/// - @LIT{geoJson}: If a geo-spatial index on a @FA{location} is constructed
/// and @LIT{geoJson} is @LIT{true}, then the order within the list is longitude
/// followed by latitude. This corresponds to the format described in <br>
/// <br>
/// http://geojson.org/geojson-spec.html#positions
///
/// - @LIT{constraint}: If @LIT{constraint} is @LIT{true}, then a geo-spatial
/// constraint instead of an index is created.
///
/// - @LIT{ignoreNull}: If a geo-spatial constraint is created and
/// @FA{ignoreNull} is true, then documents with a null in @FA{location} or at
/// least one null in @FA{latitude} or @FA{longitude} are ignored.
///
/// If the index does not already exists and could be created, then a @LIT{HTTP
/// 201} is returned. If the index already exists, then a @LIT{HTTP 200} is
/// returned.
///
/// If the @FA{collection-identifier} is unknown, then a @LIT{HTTP 404} is
/// returned. It is possible to specify a name instead of an identifier.
///
/// @EXAMPLES
///
/// Creating a geo index with a location attribute:
///
/// @verbinclude api-index-create-geo-location
///
/// Creating a geo index with latitude and longitude attributes:
///
/// @verbinclude api-index-create-geo-latitude-longitude
////////////////////////////////////////////////////////////////////////////////
function POST_api_index_geo (req, res, collection, body) {
@ -321,14 +374,6 @@ function POST_api_index_skiplist (req, res, collection, body) {
///
/// @EXAMPLES
///
/// Creating a geo index with a location attribute:
///
/// @verbinclude api-index-create-geo-location
///
/// Creating a geo index with latitude and longitude attributes:
///
/// @verbinclude api-index-create-geo-latitude-longitude
///
/// Creating an unique constraint:
///
/// @verbinclude api-index-create-new-unique-constraint