@@ -20,9 +20,31 @@ df = spark.read.format("com.marklogic.spark") \
20
20
.load()
21
21
```
22
22
23
- As shown above, ` format ` , ` spark.marklogic.client.uri ` (or the other ` spark.marklogic.client ` options
23
+ As demonstrated above, ` format ` , ` spark.marklogic.client.uri ` (or the other ` spark.marklogic.client ` options
24
24
that can be used to define the connection details), and ` spark.marklogic.read.opticQuery ` are required. The
25
- following sections provide more details about these and other options that can be set.
25
+ sections below provide more detail about these and other options that can be set.
26
+
27
+ Your Optic query can include any of the
28
+ [ different kinds of Optic operations] ( https://docs.marklogic.com/guide/app-dev/OpticAPI#id_35559 ) that MarkLogic
29
+ supports. For example, the following demonstrates how the
30
+ [ powerful MarkLogic CTS API] ( https://docs.marklogic.com/guide/search-dev/cts_query ) can be easily used within an
31
+ Optic query to constrain the returned rows based on a search query (note that the JavaScript CTS API must be used in
32
+ the Optic query):
33
+
34
+ ```
35
+ query = "op.fromView('example', 'employee').where(cts.wordQuery('Drive'))"
36
+
37
+ df = spark.read.format("com.marklogic.spark") \
38
+ .option("spark.marklogic.client.uri", "spark-example-user:password@localhost:8020") \
39
+ .option("spark.marklogic.read.opticQuery", query) \
40
+ .load()
41
+ ```
42
+
43
+ The ` where ` clause in the example above can include any of the query features supported by MarkLogic, such as
44
+ [ geospatial queries] ( https://docs.marklogic.com/guide/search-dev/geospatial ) ,
45
+ [ wildcard queries] ( https://docs.marklogic.com/guide/search-dev/wildcard ) , and
46
+ query expansion via [ a thesaurus] ( https://docs.marklogic.com/guide/search-dev/thesaurus ) or
47
+ [ spelling correction] ( https://docs.marklogic.com/guide/search-dev/spelling ) .
26
48
27
49
## Optic query requirements
28
50
0 commit comments