Skip to content

Commit

Permalink
[BP] MB-40604: Accommodate IP field into UI
Browse files Browse the repository at this point in the history
+ Uses `7.2-couchbase` branch of blevesearch/bleve
  which includes the following commit over v2.3.3:
    - blevesearch/bleve#1735

+ IP field and RangeQuery support added with:
    - blevesearch/bleve#1546
    - blevesearch/bleve#1735

Change-Id: I76cc275ebc7817ecec0521789587c1b68eeafdd9
Reviewed-on: https://review.couchbase.org/c/cbft/+/185273
Well-Formed: Restriction Checker
Tested-by: Abhi Dangeti <abhinav@couchbase.com>
Reviewed-by: Abhi Dangeti <abhinav@couchbase.com>
  • Loading branch information
abhinavdangeti committed Jan 20, 2023
1 parent 27a5742 commit ad3d8f2
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 6 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.18

require (
github.com/blevesearch/bleve-mapping-ui v0.4.0
github.com/blevesearch/bleve/v2 v2.3.3
github.com/blevesearch/bleve/v2 v2.3.4-0.20230119180143-f8e57fb59f61
github.com/blevesearch/bleve_index_api v1.0.2
github.com/blevesearch/upsidedown_store_api v1.0.1
github.com/blevesearch/zapx/v11 v11.3.4
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ github.com/blevesearch/bleve-mapping-ui v0.4.0 h1:UdnaFnr9IYxUvyyoLWeM3j7SsjkBcB
github.com/blevesearch/bleve-mapping-ui v0.4.0/go.mod h1:KUD8p9gSBGVy8dwN6lQlkG+04xT+GvFR2bEsCjJP5zc=
github.com/blevesearch/bleve/v2 v2.0.0/go.mod h1:OBP2Pktqik8vEiUlGhuWjYx7KiO4zD542+DHqICwM5w=
github.com/blevesearch/bleve/v2 v2.2.3-0.20220224151155-3c7d301db56a/go.mod h1:qw2j0QmyfQTtJXeZRFkRQYDZRDALwtG7WZji1eHtegI=
github.com/blevesearch/bleve/v2 v2.3.3 h1:aDvFXy9TxdVLcu/YmHAiLQ2VsCO7hcAYDCgm0SYDEVE=
github.com/blevesearch/bleve/v2 v2.3.3/go.mod h1:3NBtjJ4ZENIuzztTEZylWgtVdZvMWnbGcTJB7Ry/YeU=
github.com/blevesearch/bleve/v2 v2.3.4-0.20230119180143-f8e57fb59f61 h1:IrDyBLJDqpQP6AsnSEBIyiyh7JWn2vz6SMB21HNMoZk=
github.com/blevesearch/bleve/v2 v2.3.4-0.20230119180143-f8e57fb59f61/go.mod h1:3NBtjJ4ZENIuzztTEZylWgtVdZvMWnbGcTJB7Ry/YeU=
github.com/blevesearch/bleve_index_api v1.0.0/go.mod h1:fiwKS0xLEm+gBRgv5mumf0dhgFr2mDgZah1pqv1c1M4=
github.com/blevesearch/bleve_index_api v1.0.1/go.mod h1:fiwKS0xLEm+gBRgv5mumf0dhgFr2mDgZah1pqv1c1M4=
github.com/blevesearch/bleve_index_api v1.0.2 h1:rO736FwEPMVY1mGi7d4n7CgBB3+tB7uYN7QTjR+Ij+s=
Expand Down
4 changes: 3 additions & 1 deletion ns_server_static/fts/fts.js
Original file line number Diff line number Diff line change
Expand Up @@ -1635,8 +1635,10 @@ function IndexNewCtrlFTEasy_NS($scope, $http, $state, $stateParams,
$scope.editField.type = "boolean";
} else if (valType === "number") {
$scope.editField.type = "number";
} else if (valType === "geoshape") {
} else if (valType === "geoshape") {
$scope.editField.type = "geoshape";
} else if (valType === "IP") {
$scope.editField.type = "IP";
} else {
// default to text if we aren't sure
$scope.editField.type = "text";
Expand Down
2 changes: 2 additions & 0 deletions ns_server_static/fts/fts_easy_field.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ function newEditField() {
rv = "geoshape ";
} else if (this.type == "boolean") {
rv = "boolean ";
} else if (this.type == "IP") {
rv = "IP ";
}
var supporting = [];
if (this.store) {
Expand Down
26 changes: 25 additions & 1 deletion ns_server_static/fts/fts_easy_mapping.js
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,26 @@ function newEasyMapping() {
return fieldMapping;
};

var newIPField = function(field) {
var fieldMapping = {};
fieldMapping.name = field.name;
fieldMapping.type = "IP";
if (field.store) {
fieldMapping.store = true;
}
fieldMapping.index = true;
if (field.highlight || field.phrase) {
fieldMapping.include_term_vectors = true;
}
if (field.includeInAll) {
fieldMapping.include_in_all = true;
}
if (field.sortFacet) {
fieldMapping.docvalues = true;
}
return fieldMapping;
};

var addDocumentMappingFromPathField = function(mapping, path, field) {
// split dotted-path into path elements
var pathElements = path.split('.');
Expand Down Expand Up @@ -271,8 +291,10 @@ function newEasyMapping() {
mapping.fields.push(newGeoPointField(field));
} else if (field.type == "geoshape") {
mapping.fields.push(newGeoShapeField(field));
}else if (field.type == "boolean") {
} else if (field.type == "boolean") {
mapping.fields.push(newBooleanField(field));
} else if (field.type == "IP") {
mapping.fields.push(newIPField(field));
}
};

Expand Down Expand Up @@ -326,6 +348,8 @@ function newEasyMapping() {
editField.type = "geoshape";
} else if (field.type == "boolean") {
editField.type = "boolean";
} else if (field.type == "IP") {
editField.type = "IP";
}

// finish some common settings
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ function initBleveTypeMappingController($scope, typeMappingIn, options) {
var mappings = bleveConvertFromTypeMapping(typeMappingIn);


$scope.fieldTypes = ['text', 'number', 'datetime', 'boolean', 'disabled', 'geopoint', 'geoshape'];
$scope.fieldTypes = ['text', 'number', 'datetime', 'boolean', 'disabled', 'geopoint', 'geoshape', 'IP'];

var kindAttrs = {
"field": {
Expand Down

0 comments on commit ad3d8f2

Please sign in to comment.