Skip to content
This repository has been archived by the owner on Sep 12, 2022. It is now read-only.

Commit

Permalink
docs: Add docs for new "search" query parameter (LLC-294) (#81)
Browse files Browse the repository at this point in the history
  • Loading branch information
crazy-grizzly authored Jul 3, 2020
1 parent e897d8a commit d12f541
Show file tree
Hide file tree
Showing 6 changed files with 134 additions and 2 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
_site
out
.DS_Store
Gemfile*
.idea
.jekyll-cache
11 changes: 11 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# frozen_string_literal: true

source "https://rubygems.org"

git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }

gem "jekyll", "~> 4.1"

gem "jekyll-watch", "~> 2.2"

gem "jekyll-redirect-from", "~> 0.16.0"
71 changes: 71 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
GEM
remote: https://rubygems.org/
specs:
addressable (2.7.0)
public_suffix (>= 2.0.2, < 5.0)
colorator (1.1.0)
concurrent-ruby (1.1.6)
em-websocket (0.5.1)
eventmachine (>= 0.12.9)
http_parser.rb (~> 0.6.0)
eventmachine (1.2.7)
ffi (1.13.1)
forwardable-extended (2.6.0)
http_parser.rb (0.6.0)
i18n (1.8.3)
concurrent-ruby (~> 1.0)
jekyll (4.1.1)
addressable (~> 2.4)
colorator (~> 1.0)
em-websocket (~> 0.5)
i18n (~> 1.0)
jekyll-sass-converter (~> 2.0)
jekyll-watch (~> 2.0)
kramdown (~> 2.1)
kramdown-parser-gfm (~> 1.0)
liquid (~> 4.0)
mercenary (~> 0.4.0)
pathutil (~> 0.9)
rouge (~> 3.0)
safe_yaml (~> 1.0)
terminal-table (~> 1.8)
jekyll-redirect-from (0.16.0)
jekyll (>= 3.3, < 5.0)
jekyll-sass-converter (2.1.0)
sassc (> 2.0.1, < 3.0)
jekyll-watch (2.2.1)
listen (~> 3.0)
kramdown (2.3.0)
rexml
kramdown-parser-gfm (1.1.0)
kramdown (~> 2.0)
liquid (4.0.3)
listen (3.2.1)
rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10)
mercenary (0.4.0)
pathutil (0.16.2)
forwardable-extended (~> 2.6)
public_suffix (4.0.5)
rb-fsevent (0.10.4)
rb-inotify (0.10.1)
ffi (~> 1.0)
rexml (3.2.4)
rouge (3.20.0)
safe_yaml (1.0.5)
sassc (2.4.0)
ffi (~> 1.9)
terminal-table (1.8.0)
unicode-display_width (~> 1.1, >= 1.1.1)
unicode-display_width (1.7.0)

PLATFORMS
ruby

DEPENDENCIES
jekyll (~> 4.1)
jekyll-redirect-from (~> 0.16.0)
jekyll-watch (~> 2.2)

BUNDLED WITH
2.1.4
9 changes: 9 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,13 @@ Alternatively:
3. Commit and push your changes to Github.
4. Create a [pull request](/pulls) on Github (ensuring that you follow the [guidelines](/contributing.md)).

### Development
1. Install [Ruby](https://www.ruby-lang.org/en/documentation/installation/)
2. Install [Bundler](https://bundler.io/)
3. Run `bundler install`
4. Run `jekyll server --watch`
5. Go to `http://127.0.0.1:4000` in your browser

For each change in the src files jekyll will automatically recompile the dist files.

Note that the documentation site is generated using [Jekyll](http://jekyllrb.com/). To learn more about the repository structure, please view the [Jekyll documentation](http://jekyllrb.com/docs/home/).
20 changes: 19 additions & 1 deletion src/http-connection.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ http://www.example.org/api/connection/statement
You must additionally supply your Basic Auth details with each request in the `Authorization` header. Your Basic Auth details can be found under **Settings** > **Clients**. The API also accepts the following *optional* URL parameters for filtering the models returned.

- [sort](#sort-parameter) (required - we recommend sorting by `_id` if nothing else)
- [filter](#filter-parameter)
- [search](#search-parameter) (available only for user connection in Enterprise)
- [filter](#filter-parameter) (not available for User connection)
- [project](#project-parameter)
- [hint](#hint-parameter)
- [first](#first-parameter)
Expand Down Expand Up @@ -54,6 +55,23 @@ Note that when using extension keys, you need to replace any dots with `&46;` be
#### Sorting With Improved Performance
You may find that changing the sort parameter can vary the time it takes a query to run, especially when you have a large number of models. You can take advantage of database indexes to improve performance, more information is available about [using indexes via Mongo's documentation](https://docs.mongodb.com/manual/indexes/). If utilising indexes doesn't have the required performance improvement, you can instead utilise [BI tools](../guides-retrieving).

### Search Parameter
The search parameter is a simple string and **available only for User connection**. This parameter is gonna search for the match over `name` and `email` fields of User schema. So if the value for this parameter is `exampleSearchString`, as shown in the request below, it will be transformed into filter as shown below.

```http
GET http://www.example.org/api/connection/user?search=exampleSearchString
Authorization: Basic YOUR_BASIC_AUTH
```

```json
{
"$or": [
{ "name": { "$regex": "exampleSearchString", "$options": "i" } },
{ "email": { "$regex": "exampleSearchString", "$options": "i" } }
]
}
```

### Filter Parameter
The filter parameter is a JSON encoded object. The keys of the object represent the names of the properties or operators. The values of the object represent the value you wish to filter by.

Expand Down
22 changes: 22 additions & 0 deletions src/http-rest.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,17 @@ Content-Type: application/json; charset=utf-8

For more information about the acceptable URL query parameters, view the [Restify documentation](https://florianholzapfel.github.io/express-restify-mongoose/#querying).

**Important:** In case of **User** route, [query](https://florianholzapfel.github.io/express-restify-mongoose/#querying) parameter will be ignored and `search` parameter should be used instead (only available in Enterprise). `search` query parameter is a simple string and will be transformed into filter shown below.

```json
{
"$or": [
{ "name": { "$regex": "exampleSearchString", "$options": "i" } },
{ "email": { "$regex": "exampleSearchString", "$options": "i" } }
]
}
```

### GET /
This route returns an array of models. A request to this route would look something like the request below.

Expand Down Expand Up @@ -101,6 +112,17 @@ Content-Type: application/json; charset=utf-8

For more information about the acceptable URL query parameters, view the [Restify documentation](https://florianholzapfel.github.io/express-restify-mongoose/#querying).

**Important:** In case of **User** route, [query](https://florianholzapfel.github.io/express-restify-mongoose/#querying) parameter will be ignored and `search` parameter should be used instead. `search` query parameter is a simple string and will be transformed into filter shown below.

```json
{
"$or": [
{ "name": { "$regex": "exampleSearchString", "$options": "i" } },
{ "email": { "$regex": "exampleSearchString", "$options": "i" } }
]
}
```

### POST /
This route creates a model. A request to this route would look something like the request below. Different models will require and respond with a different schema, you can view the schemas by clicking the model names in the [model table above](#models).

Expand Down

0 comments on commit d12f541

Please sign in to comment.