Skip to content

Commit

Permalink
update example code for text match - use of 'not' keyword
Browse files Browse the repository at this point in the history
Signed-off-by: liyun95 <[email protected]>
  • Loading branch information
liyun95 committed Dec 23, 2024
1 parent 659760b commit a3b4130
Showing 1 changed file with 46 additions and 19 deletions.
65 changes: 46 additions & 19 deletions site/en/userGuide/search-query-get/keyword-match.md
Original file line number Diff line number Diff line change
Expand Up @@ -269,30 +269,57 @@ const filter = "TEXT_MATCH(text, 'machine deep')";
export filter="\"TEXT_MATCH(text, 'machine deep')\""
```

You can also combine multiple `TEXT_MATCH` expressions using logical operators to perform **AND** matching. For example, to search for documents containing both `machine` and `deep` in the `text` field, use the following expression:​
You can also combine multiple `TEXT_MATCH` expressions using logical operators to perform **AND** matching.

<div class="multipleCode">
<a href="#python">Python </a>
<a href="#java">Java</a>
<a href="#javascript">Node.js</a>
<a href="#curl">cURL</a>
</div>
- To search for documents containing both `machine` and `deep` in the `text` field, use the following expression:​

```python
filter = "TEXT_MATCH(text, 'machine') and TEXT_MATCH(text, 'deep')"
```
<div class="multipleCode">
<a href="#python">Python </a>
<a href="#java">Java</a>
<a href="#javascript">Node.js</a>
<a href="#curl">cURL</a>
</div>

```java
String filter = "TEXT_MATCH(text, 'machine') and TEXT_MATCH(text, 'deep')";
```
```python
filter = "TEXT_MATCH(text, 'machine') and TEXT_MATCH(text, 'deep')"
```

```javascript
const filter = "TEXT_MATCH(text, 'machine') and TEXT_MATCH(text, 'deep')"
```
```java
String filter = "TEXT_MATCH(text, 'machine') and TEXT_MATCH(text, 'deep')";
```

```curl
export filter="\"TEXT_MATCH(text, 'machine') and TEXT_MATCH(text, 'deep')\""
```
```javascript
const filter = "TEXT_MATCH(text, 'machine') and TEXT_MATCH(text, 'deep')"
```

```curl
export filter="\"TEXT_MATCH(text, 'machine') and TEXT_MATCH(text, 'deep')\""
```

- To search for documents containing both `machine` and `learning` but without `deep` in the `text` field, use the following expressions:

<div class="multipleCode">
<a href="#python">Python </a>
<a href="#java">Java</a>
<a href="#javascript">Node.js</a>
<a href="#curl">cURL</a>
</div>

```python
filter = "not TEXT_MATCH(text, 'deep') and TEXT_MATCH(text, 'machine') and TEXT_MATCH(text, 'learning')"
```

```java
String filter = "not TEXT_MATCH(text, 'deep') and TEXT_MATCH(text, 'machine') and TEXT_MATCH(text, 'learning')";
```

```javascript
const filter = "not TEXT_MATCH(text, 'deep') and TEXT_MATCH(text, 'machine') and TEXT_MATCH(text, 'learning')";
```

```curl
export filter="\"not TEXT_MATCH(text, 'deep') and TEXT_MATCH(text, 'machine') and TEXT_MATCH(text, 'learning')\""
```

### Search with text match​

Expand Down

0 comments on commit a3b4130

Please sign in to comment.