Skip to content

Commit b6afd22

Browse files
authored
Merge pull request #32 from silverstripeltd/bugfix/AOS-100-sanitisation-for-xss
AOS-100: Add documentation regards the Query class and sanitising the…
2 parents 4171ad4 + 2ed9313 commit b6afd22

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

docs/detailed-result-handling.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,17 @@ simple methods available that you can access anywhere.
2020
* `isSuccess()`: Simply states whether or not the search was a success, or error.
2121
* `getRecords()`: A `PaginatedList` of `Record` objects that were returned by the search service based on your `Query`.
2222
* `getFacets`: An `ArrayList` of `Facet` objects that were returned by the search service based on your `Query`.
23+
* `getQuery`": The `Query` object
2324

2425
The `Results` class is also a `ViewableData` object, so these methods can be access in your template with `$isSuccess`,
25-
`$Records`, and `$Facets`.
26+
`$Records`, `$Facets`, and `$Query`.
27+
28+
## `Query` class
29+
The `Query` class provides the original query that was used for matching results. This is available should you wish
30+
to include `Showing results for "test"` or similar text on your results page.
31+
32+
**Important:** When including `$Query` in the template it should be noted that this assumes the query string is
33+
safe and that the implementation has sanitised the user input to mitigate against cross-site scripting (xss) attacks.
2634

2735
## `Record` class
2836

0 commit comments

Comments
 (0)