Skip to content

Commit 90f859f

Browse files
authored
Merge pull request #53 from swiftype/add-suggestions-to-readme
Added Query Suggestion to README
2 parents b4495a4 + 10ce322 commit 90f859f

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

README.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,37 @@ ResultItem {
160160
}
161161
```
162162

163+
#### Query Suggestion
164+
165+
```javascript
166+
var options = {
167+
size: 3,
168+
types: {
169+
documents: {
170+
fields: ["name"]
171+
}
172+
}
173+
};
174+
175+
client
176+
.querySuggestion("cat", {
177+
size: 3,
178+
types: {
179+
documents: {
180+
fields: ["name"]
181+
}
182+
}
183+
})
184+
.then(response => {
185+
response.results.documents.forEach(document => {
186+
console.log(document.suggestion);
187+
});
188+
})
189+
.catch(error => {
190+
console.log(`error: ${error}`);
191+
});
192+
```
193+
163194
#### Multi Search
164195

165196
It is possible to run multiple queries at once using the `multiSearch` method.

0 commit comments

Comments
 (0)