Skip to content

Commit

Permalink
Merge branch 'master' into github
Browse files Browse the repository at this point in the history
  • Loading branch information
boardthatpowder committed Jan 5, 2022
2 parents 9c63574 + 645a001 commit d868cb9
Show file tree
Hide file tree
Showing 9 changed files with 84 additions and 7 deletions.
12 changes: 12 additions & 0 deletions source/packages/integration-tests/CHANGELOG.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
{
"name": "@cdf/integration-tests",
"entries": [
{
"version": "2.9.5",
"tag": "@cdf/integration-tests_v2.9.5",
"date": "Wed, 05 Jan 2022 18:34:59 GMT",
"comments": {
"patch": [
{
"comment": "Asset Library Search query not constructed properly when a traversal search was specified followed by a non-traversal search."
}
]
}
},
{
"version": "2.9.4",
"tag": "@cdf/integration-tests_v2.9.4",
Expand Down
9 changes: 8 additions & 1 deletion source/packages/integration-tests/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
# Change Log - @cdf/integration-tests

This log was last generated on Wed, 29 Dec 2021 20:21:35 GMT and should not be manually modified.
This log was last generated on Wed, 05 Jan 2022 18:34:59 GMT and should not be manually modified.

## 2.9.5
Wed, 05 Jan 2022 18:34:59 GMT

### Patches

- Asset Library Search query not constructed properly when a traversal search was specified followed by a non-traversal search.

## 2.9.4
Wed, 29 Dec 2021 20:21:35 GMT
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,27 @@ Feature: Device search
And search result contains device "test-devicesearch-002a"
And search result contains device "test-devicesearch-002b"

Scenario: Multiple search criteria including a traversal
When I search with following attributes:
| type | TEST-deviceSearch-device-004 |
| eq | located_at:out:name:deviceSearch_feature,deviceId:TEST-deviceSearch-001A,pair:black-black |
Then search result contains 1 results
And search result contains device "test-devicesearch-001a"

Scenario: Multiple search criteria including a traversal with changed order of search criteria
When I search with following attributes:
| type | TEST-deviceSearch-device-004 |
| eq | deviceId:TEST-deviceSearch-001A,located_at:out:name:deviceSearch_feature,pair:black-black |
Then search result contains 1 results
And search result contains device "test-devicesearch-001a"

Scenario: Multiple search criteria including a traversal with another changed order of search criteria
When I search with following attributes:
| type | TEST-deviceSearch-device-004 |
| eq | deviceId:TEST-deviceSearch-001A,pair:black-black,located_at:out:name:deviceSearch_feature |
Then search result contains 1 results
And search result contains device "test-devicesearch-001a"

@teardown_deviceSearch_feature
Scenario: Teardown
Given device "TEST-deviceSearch-001A" does not exist
Expand Down
2 changes: 1 addition & 1 deletion source/packages/integration-tests/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@cdf/integration-tests",
"version": "2.9.4",
"version": "2.9.5",
"description": "CDF Integration Tests",
"author": "Dean Hart",
"config": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ import {
Group10Resource,
SearchRequestFilter,
ASSTLIBRARY_CLIENT_TYPES,
SearchRequestFilterTraversal,
SearchRequestFilterDirection,
} from '@cdf/assetlibrary-client/dist';

import chai_string = require('chai-string');
Expand Down Expand Up @@ -77,7 +79,14 @@ function buildSearchRequest(data:TableDefinition):SearchRequestModel {
};
// do we have traversals defined?
if (attrs.length>2) {
// TODO: process traversals
const traversals:SearchRequestFilterTraversal[] = [];
for(let i=attrs.length-4; i>=0; i=-2) {
traversals.unshift({
relation: attrs[i],
direction: attrs[i+1] as SearchRequestFilterDirection
});
}
filter.traversals = traversals;
}

searchRequest[param].push(filter);
Expand Down
12 changes: 12 additions & 0 deletions source/packages/services/assetlibrary/CHANGELOG.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
{
"name": "@cdf/assetlibrary",
"entries": [
{
"version": "5.4.1",
"tag": "@cdf/assetlibrary_v5.4.1",
"date": "Wed, 05 Jan 2022 18:34:59 GMT",
"comments": {
"patch": [
{
"comment": "Search query not constructed properly when a traversal search was specified followed by a non-traversal search."
}
]
}
},
{
"version": "5.4.0",
"tag": "@cdf/assetlibrary_v5.4.0",
Expand Down
9 changes: 8 additions & 1 deletion source/packages/services/assetlibrary/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
# Change Log - @cdf/assetlibrary

This log was last generated on Wed, 29 Dec 2021 20:21:35 GMT and should not be manually modified.
This log was last generated on Wed, 05 Jan 2022 18:34:59 GMT and should not be manually modified.

## 5.4.1
Wed, 05 Jan 2022 18:34:59 GMT

### Patches

- Search query not constructed properly when a traversal search was specified followed by a non-traversal search.

## 5.4.0
Wed, 29 Dec 2021 20:21:35 GMT
Expand Down
2 changes: 1 addition & 1 deletion source/packages/services/assetlibrary/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@cdf/assetlibrary",
"version": "5.4.0",
"version": "5.4.1",
"description": "CDF Asset Library",
"author": "Dean Hart",
"config": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,70 +62,81 @@ export class SearchDaoFull extends BaseDaoFull {

if (request.eq!==undefined) {
request.eq.forEach(f=> {
traverser.select('a');
this.buildSearchFilterVBase(f, traverser);
traverser.has(f.field, f.value);
});
}
if (request.neq!==undefined) {
request.neq.forEach(f=> {
traverser.select('a');
this.buildSearchFilterVBase(f, traverser);
traverser.not(__.has(f.field, f.value));
});
}
if (request.lt!==undefined) {
request.lt.forEach(f=> {
traverser.select('a');
this.buildSearchFilterVBase(f, traverser);
traverser.has(f.field, process.P.lt(Number(f.value)));
});
}
if (request.lte!==undefined) {
request.lte.forEach(f=> {
traverser.select('a');
this.buildSearchFilterVBase(f, traverser);
traverser.has(f.field, process.P.lte(Number(f.value)));
});
}
if (request.gt!==undefined) {
request.gt.forEach(f=> {
traverser.select('a');
this.buildSearchFilterVBase(f, traverser);
traverser.has(f.field, process.P.gt(Number(f.value)));
});
}
if (request.gte!==undefined) {
request.gte.forEach(f=> {
traverser.select('a');
this.buildSearchFilterVBase(f, traverser);
traverser.has(f.field, process.P.gte(Number(f.value)));
});
}
if (request.startsWith!==undefined) {
request.startsWith.forEach(f=> {
traverser.select('a');
this.buildSearchFilterVBase(f, traverser);
traverser.has(f.field, process.TextP.startingWith(f.value));
});
}

if (request.endsWith!==undefined) {
request.endsWith.forEach(f=> {
traverser.select('a');
this.buildSearchFilterVBase(f, traverser);
traverser.has(f.field, process.TextP.endingWith(f.value));
});
}

if (request.contains!==undefined) {
request.contains.forEach(f=> {
traverser.select('a');
this.buildSearchFilterVBase(f, traverser);
traverser.has(f.field, process.TextP.containing(f.value));
});
}

if (request.exists!==undefined) {
request.exists.forEach(f=> {
traverser.select('a');
this.buildSearchFilterEBase(f, traverser);
traverser.has(f.field, f.value);
});
}

if (request.nexists!==undefined) {
request.nexists.forEach(f=> {
traverser.select('a');
this.buildSearchFilterEBaseNegated(f, traverser, f.field, f.value);
});
}
Expand Down Expand Up @@ -155,7 +166,6 @@ export class SearchDaoFull extends BaseDaoFull {

private buildSearchFilterVBase(filter:SearchRequestFilter|SearchRequestFacet, traverser:process.GraphTraversal) : void {
if (filter.traversals) {
traverser.select('a');
filter.traversals.forEach(t=> {
if (t.direction===SearchRequestFilterDirection.in) {
traverser.in_(t.relation);
Expand All @@ -168,7 +178,6 @@ export class SearchDaoFull extends BaseDaoFull {

private buildSearchFilterEBase(filter:SearchRequestFilter|SearchRequestFacet, traverser:process.GraphTraversal) : void {
if (filter.traversals) {
traverser.select('a');
filter.traversals.forEach(t=> {
if (t.direction===SearchRequestFilterDirection.in) {
traverser.inE(t.relation);
Expand Down

0 comments on commit d868cb9

Please sign in to comment.