Skip to content

Add support for Fts auto Complete and docs + tests #406

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 27 commits into
base: DA-392-Add-Search-Query-Validation
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
c801a21
DA-450 basic workbench keyword recommendation (#389)
lokesh-couchbase May 29, 2024
4c02da3
bump package version
lokesh-couchbase May 29, 2024
15a3398
Da 451 release bug fix (#391)
lokesh-couchbase May 29, 2024
c2b0f44
Add KV Range Filter, Named parameters, Basic Workbench Autocomplete (…
lokesh-couchbase May 29, 2024
ecc2487
DA-459 add n1ql file support (#394)
lokesh-couchbase Jun 5, 2024
e60f755
Merge Branch Main into development (#396)
lokesh-couchbase Jun 12, 2024
818cb5b
bump version and remove unwanted line in code
lokesh-couchbase Jun 12, 2024
83236a2
resolve merge conflicts
lokesh-couchbase Jun 12, 2024
04d3397
resolve merge conflicts
lokesh-couchbase Jun 12, 2024
36975d8
Add feature to support N1QL Files (#397)
lokesh-couchbase Jun 12, 2024
5ca51b7
Add UI Support for DynamoDB to Couchbase (#403)
prajwal-pai77 Jul 1, 2024
4697ffe
merge main to development
prajwal-pai77 Jul 1, 2024
a6273b9
Add support for Fts auto Complete and docs + tests
prajwal-pai77 Jul 16, 2024
0c9cb88
Update test.yml CI to use node version 20
prajwal-pai77 Jul 16, 2024
d6a17b4
Update Test ci
prajwal-pai77 Jul 16, 2024
a97e331
Update package.json
prajwal-pai77 Jul 16, 2024
ed114d4
Update test ci
prajwal-pai77 Jul 16, 2024
868f6e1
Update test ci
prajwal-pai77 Jul 16, 2024
5673751
Add Rebuild step
prajwal-pai77 Jul 16, 2024
b7d5490
Add prerequisite steps
prajwal-pai77 Jul 16, 2024
8241aa0
Update trigger in CI
prajwal-pai77 Jul 16, 2024
cfc0dd9
Big Fixes from suggestions
prajwal-pai77 Jul 18, 2024
b8f1590
Update package version and changelog
prajwal-pai77 Jul 18, 2024
f19d659
Update changelog + format using prettier
prajwal-pai77 Jul 18, 2024
9a39b63
Merge branch 'development' into DA-395-Add-Fts-Autocomplete
prajwal-pai77 Jul 18, 2024
900ed48
Minor fix
prajwal-pai77 Jul 18, 2024
89489db
Add pre-release flag in ci
prajwal-pai77 Jul 19, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ jobs:
- name: windows-specific
shell: pwsh
if: matrix.platform == 'win32'
run: choco install openssl.light --version=1.1.1 && choco install cmake --global && npm install --global cmake-js node-gyp && echo CMAKE_JS_LIB - $CMAKE_JS_LIB
run: choco install openssl.light --version=1.1.1 && choco install cmake --global && npm install --global cmake-js node-gyp && echo CMAKE_JS_LIB - $CMAKE_JS_LIB
- name: mac-specific
shell: bash
if: matrix.platform == 'darwin'
Expand All @@ -78,7 +78,7 @@ jobs:
echo "PATH=${WORKING_DIRECTORY}/cmake-3.27.9-linux-x86_64/bin:$PATH" >> $GITHUB_ENV
- name: general
run: npm i && npm run rebuild
- run: npx vsce package --target ${{ env.target }}
- run: npx vsce package --target ${{ env.target }} --pre-release
- uses: actions/upload-artifact@v4
with:
name: ${{ env.target }}
Expand Down
21 changes: 20 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,28 @@ jobs:
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 16.x
node-version: 20
- run: echo '${{ secrets.CONFIG_JSON }}' > ${{ github.workspace }}/src/config.json
- uses: ilammy/setup-nasm@v1
- name: windows-specific
shell: pwsh
if: runner.os == 'Windows'
run: choco install openssl.light --version=1.1.1 && choco install cmake --global && npm install --global cmake-js node-gyp && echo CMAKE_JS_LIB - $CMAKE_JS_LIB
- name: linux-specific
shell: bash
if: runner.os == 'Linux'
run: |
ldd --version
rm -rf /usr/local/bin/cmake
wget https://cmake.org/files/v3.27/cmake-3.27.9-linux-x86_64.tar.gz
tar xf cmake-3.27.9-linux-x86_64.tar.gz
WORKING_DIRECTORY=$(pwd)
echo "${WORKING_DIRECTORY}/cmake-3.27.9-linux-x86_64/bin" >> $GITHUB_PATH
echo "PATH=${WORKING_DIRECTORY}/cmake-3.27.9-linux-x86_64/bin:$PATH" >> $GITHUB_ENV
- name: Install Dependencies
run: npm install
- name: Run Rebuild
run: npm run rebuild
- name: Run Tests
if: runner.os == 'Linux'
run: xvfb-run -a npm test
Expand Down
20 changes: 20 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,25 @@
# Change Log

## [v2.1.0]
- Add FTS workbench support inside extension
- Add FTS workbench json validation
- Add FTS workbench json auto complete feature
- Add FTS workbench documentation

## [v2.0.5]
- Add UI support for DynamoDB To Couchbase Data Migration

## [v2.0.4]
- Add support for N1QL (.n1ql) files in query workbench

## [v2.0.3]
- KV Range based document filter
- Named Parameters Support
- Basic Autocomplete Support

## [v2.0.1]
- Update Filter Documents and Capella iQ Bug Fixes

## [v2.0.0]
- Bump Node.js version to 20
- Add MongoDB to Couchbase data Migration tool
Expand Down
62 changes: 62 additions & 0 deletions __mocks__/vscode.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
// __mocks__/vscode.js

const vscode = {
languages: {
createDiagnosticCollection: jest.fn().mockImplementation(() => {
const diagnosticsMap = new Map();
return {
clear: jest.fn(() => diagnosticsMap.clear()),
dispose: jest.fn(),
get: jest.fn((uri) => diagnosticsMap.get(uri.toString())),
set: jest.fn((uri, diagnostics) =>
diagnosticsMap.set(uri.toString(), diagnostics),
),
delete: jest.fn((uri) => diagnosticsMap.delete(uri.toString())),
forEach: jest.fn((callback) =>
diagnosticsMap.forEach(callback),
),
};
}),
},
Uri: {
parse: jest.fn().mockImplementation((str) => ({
toString: () => str,
})),
},
workspace: {
openTextDocument: jest.fn().mockImplementation((uri) => ({
getText: jest.fn(() => ""),
uri: uri,
positionAt: jest.fn().mockImplementation((index) => {
return new vscode.Position(
Math.floor(index / 100),
index % 100,
);
}),
})),
fs: {
writeFile: jest.fn(),
},
},
Range: jest.fn().mockImplementation((start, end) => ({
start: start,
end: end,
})),
Position: jest.fn().mockImplementation((line, character) => ({
line: line,
character: character,
})),
Diagnostic: jest.fn().mockImplementation((range, message, severity) => ({
range: range,
message: message,
severity: severity,
})),
DiagnosticSeverity: {
Error: 0,
Warning: 1,
Information: 2,
Hint: 3,
},
};

module.exports = vscode;
7 changes: 7 additions & 0 deletions docs/search/analyzer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Use the **analyzer** property to modify the behavior of a match query or a match phrase query.

Set the **analyzer** property to the name of the analyzer you want to use on the contents of the match property or match_phrase property.

The specified analyzer only applies to the content of your Search request. It does not apply to the contents of documents in the Search index. However, the analyzer set on your Search request and in your Search index should match.

→ [Additional Query Object Documentation](https://docs.couchbase.com/server/current/search/search-request-params.html#additional-query-properties)
7 changes: 7 additions & 0 deletions docs/search/bool.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Use the **bool** property to query a field that contains a boolean value.

Use the field property and set the **bool** property to true or false to run a search.

The Search Service does not use any analyzers on the contents of your query.

→ [Non-Analytics Query Documentation]("https://docs.couchbase.com/server/current/search/search-request-params.html#non-analytic-queries")
5 changes: 5 additions & 0 deletions docs/search/boost.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
If you use multiple clauses in a query, you can use the **boost** property to assign the relative importance to a clause.

Clauses with a higher value in the **boost** property score higher and appear earlier in search results.

→ [Additional Query Object Documentation](https://docs.couchbase.com/server/current/search/search-request-params.html#additional-query-properties)
11 changes: 11 additions & 0 deletions docs/search/bottom_right.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Set the geo location value to use as the bottom-right corner point of the rectangle search area.

If you use **bottom_right** as an object, you must set two values:

→ **lon**: The longitude of the geo location to use as the bottom-right corner of the rectangle.

→ **lat**: The latitude of the geo location to use as the bottom-right corner of the rectangle.

If you use **bottom_right** as an array, your array must contain a longitude value followed by a latitude value. For example, [-2.235143, 53.482358], where -2.235143 is the longitude.

→ [Rectangle-Based Geopoint Query Documentation](https://docs.couchbase.com/server/current/search/search-request-params.html#geopoint-queries-rectangle)
5 changes: 5 additions & 0 deletions docs/search/cidr.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Enter an IP address range or single IP address, in IPv4 or IPv6 CIDR notation.

The Search Service returns documents with IP addresses that fall inside the specified range or match the specified IP address.

→ [IP Address Range Query Documentation](https://docs.couchbase.com/server/current/search/search-request-params.html#ip-address-range-queries)
3 changes: 3 additions & 0 deletions docs/search/collections.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Contains an array of strings that specify the collections where you want to run the query.

→ [Search Request Json Documentation](https://docs.couchbase.com/server/current/search/search-request-params.html)
9 changes: 9 additions & 0 deletions docs/search/conjuncts.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Use the **conjuncts** array to specify multiple child queries in a single query object.

You can use the **conjuncts** array inside a must object or directly inside a query object.

If you use the **conjuncts** array, every query object in the array must have a match in a document to include the document in search results.

You can create objects in a **conjuncts** array to describe any of the available query types.

→ [Compound Query Documentation](https://docs.couchbase.com/server/current/search/search-request-params.html#boolean-queries)
5 changes: 5 additions & 0 deletions docs/search/consistency.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Use the **consistency** object to control the consistency behavior for a Search index

It contains a **vectors** object, the **level** and **results** properties.

→ [Consistency Object Documentation](https://docs.couchbase.com/server/current/search/search-request-params.html#consistency)
72 changes: 72 additions & 0 deletions docs/search/coordinates.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
An array of coordinate floating point values that define the GeoJSON shape.

The Search Service uses the first value in the coordinates array as the longitude value.

#### Point Query
For a **Point** query, set the **coordinates** array to a single array with a longitude and latitude value

#### LineString Query
For a **LineString** query, the **coordinates** array can contain multiple coordinate point arrays.

#### Polygon Query

An array that contains an outer array, and arrays of 2 coordinate floating point values that define the GeoJSON Polygon shape.

The Search Service uses the first value in any nested **coordinates** array as the longitude value for the coordinate.

The Search Service also follows strict GeoJSON syntax, and expects exterior coordinates in a polygon to be in counterclockwise order.

#### MultiPoint Query
An array that contains arrays of 2 coordinate floating point values that define the GeoJSON MultiPoint shape.

#### MultiLineString Query

An array that contains nested arrays, each with their own nested arrays of 2 coordinate floating point values.

For example, the following coordinates array defines 2 LineStrings with start and end points:
"coordinates": [
[
[1.954764, 50.962097], [3.029578, 49.868547]
],
[
[3.029578, 49.868547], [-0.387444, 48.545836]
]
]
The innermost arrays define the individual points for a LineString in the MultiLineString shape.

#### MultiPolygon Query
An array that contains arrays that describe a GeoJSON Polygon shape.

Each inner array that describes a Polygon can contain multiple arrays with 2 coordinate floating point values. These innermost arrays describe the coordinates of the Polygon.

The Search Service also follows strict GeoJSON syntax, and expects exterior coordinates in a polygon to be in counterclockwise order

#### GeometryCollection Query

An array or array of arrays that describes a GeoJSON shape.

The exact structure of the arrays depends on the shape:

→ Point
→ LineString
→ Polygon
→ MultiPoint
→ MultiLineString
→ MultiPolygon

For any array that contains only floating point values, the Search Service uses the first value as the longitude.

The Search Service also follows strict GeoJSON syntax, and expects exterior coordinates in a polygon to be in counterclockwise order.

#### Circle Query
An array of coordinate floating point values that define the center point of the Circle.

Set the **coordinates** array to a single array with a longitude and latitude value.

#### Envelope Query

An array of 2 different arrays that contain coordinate floating point values.

The first **coordinates** nested array contains the minimum longitude and maximum latitude, or the top-left corner of the rectangle.

The second nested array contains the maximum longitude and minimum latitude, or the bottom-right corner.
5 changes: 5 additions & 0 deletions docs/search/ctl.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Use the **ctl** object to make sure that the Search Service runs your Search query against the latest version of the documents in your database.

The **ctl** object and its properties cause the Search Service to run your query against the latest version of a document written to a vBucket. The Search Service uses a consistency vector to synchronize the last document write to a vBucket from the Data Service with the Search index.

→ [Ctl Object Documentation](https://docs.couchbase.com/server/current/search/search-request-params.html#ctl)
9 changes: 9 additions & 0 deletions docs/search/disjuncts.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Use the **disjuncts** array to specify multiple child queries in a single query object.

You can use the **disjuncts** array inside a must_not object, should object, or directly inside a query object.

Use a min property to set the number of query objects from the **disjuncts** array that must have a match in a document. If a document does not match the min number of query objects, the Search Service does not include the document in search results.

You can create objects in a **disjuncts** array to describe any of the available query types.

→ [Compound Query Documentation](https://docs.couchbase.com/server/current/search/search-request-params.html#boolean-queries)
16 changes: 16 additions & 0 deletions docs/search/distance.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
The radius where the Search Service should search for matching geo location values.

Enter the radius as a single string, with a numeric value and a unit value. For example, 100.5mi.

You can use the following distance units:

→ **mm:** Millimeters
→ **cm:** Centimeters
→ **in:** Inches
→ **yd:** Yards
→ **ft:** Feet
→ **m:** Meters
→ **km:** Kilometers
→ **mi:** Miles

→ [Distance/Radius-Based Geopoint Query Documentation](https://docs.couchbase.com/server/current/search/search-request-params.html#geopoint-queries-distance)
7 changes: 7 additions & 0 deletions docs/search/end.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Set the end date of the date range that you want to search for.

You can specify only an **end** value or only a **start** value on your date range.

By default, **end** is exclusive to the range.

→ [Date Range Query Documentation](https://docs.couchbase.com/server/current/search/search-request-params.html#date-range-queries)
5 changes: 5 additions & 0 deletions docs/search/explain.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
To create an explanation for a search result's score in search results, set **explain** to true.

To turn off explanations for search result scoring, set **explain** to false.

→ [Search Request Json Documentation](https://docs.couchbase.com/server/current/search/search-request-params.html)
9 changes: 9 additions & 0 deletions docs/search/facets.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Contains **{facet-name}** objects to define each facet you want to return with search results.

The Search Service supports the following facet types:

→ **Term Facet**: Counts the documents that have the same value for a specified field.

→ **Numeric Range Facet**: Counts the documents with numeric field values that are greater than or less than a specified range or ranges.

→ **Date Range Facet**: Counts the documents with date field values that are earlier or later than a specified range or ranges.
3 changes: 3 additions & 0 deletions docs/search/field.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Specify a specific field name, using dot notation, where the Search Service should search for a match to your search query.

→ [Additional Query Object Documentation](https://docs.couchbase.com/server/current/search/search-request-params.html#additional-query-properties)
5 changes: 5 additions & 0 deletions docs/search/fields.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
An array of strings to specify each indexed field you want to return in search results.

You must add a field and its contents to a Search index to view it in search results or add it to the **fields** array.

→ [Search Request Json Documentation](https://docs.couchbase.com/server/current/search/search-request-params.html)
9 changes: 9 additions & 0 deletions docs/search/fuzziness.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Use the **fuzziness** property to run a fuzzy query.

The **fuzziness** property uses your specified edit distance to match terms based on their similarity, rather than exact matches.

You can set **fuzziness** to a maximum value of 2.

Use the **fuzziness** property with the term property for a term query or the match property for a match query.

→ [Additional Query Object Documentation](https://docs.couchbase.com/server/current/search/search-request-params.html#additional-query-properties)
12 changes: 12 additions & 0 deletions docs/search/geometries.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Contains objects to define each GeoJSON shape in the GeometryCollection.

Each object in the **geometries** array has a **type** property and a coordinates property.

Set the type property inside the object to the specific shape type you want to define:

→ Point
→ LineString
→ Polygon
→ MultiPoint
→ MultiLineString
→ MultiPolygon
3 changes: 3 additions & 0 deletions docs/search/geometry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Contains the **shape** property and **relation** property.

Defines the GeoJSON shape and how the Search Service should find a match in documents.
10 changes: 10 additions & 0 deletions docs/search/highlight.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Use the **highlight** object to control how the Search Service highlights matches in search results.

```json
"highlight": {
"style": "html",
"fields": ["textField"]
},
```

→ [Highlight Object Documentation](https://docs.couchbase.com/server/current/search/search-request-params.html#highlight)
Loading
Loading