Reputation: 21
I have the following code:
cts:and-query((
cts:element-word-query(xs:QName("primaryie"), $textname, "case-insensitive"),
cts:element-query(xs:QName("beginpage"),
cts:and-query(()))
))
but would like to add a cts:or-query
to find the hightlighed "docpage" but can't figure out what to use. I tried cts:element-query
but I think it isn't an element. It seems like a marker or something. Any suggestions?
Upvotes: 2
Views: 183
Reputation: 66714
There is not currently a way to create an index on a processing-instruction()
(using a path-range-index or otherwise).
If you are already leveraging the envelope pattern, you could materialize that processing-instruction()
as an element in your envelope i.e. <docpage num="i"/>
and then use cts:element-attribute-value-query()
cts:and-query((
cts:element-word-query(xs:QName("primaryie"), $textname, "case-insensitive"),
cts:or-query((
cts:element-query(xs:QName("beginpage"),
cts:element-attribute-value-query(xs:QName("docpage"), xs:QName("num"), "i")
))
))
Or you could create a document property and then use cts:properties-fragment-query()
cts:and-query((
cts:element-word-query(xs:QName("primaryie"), $textname, "case-insensitive"),
cts:or-query((
cts:element-query(xs:QName("beginpage"),
cts:document-fragment-query(
cts:element-attribute-value-query(xs:QName("docpage"), xs:QName("num"), "i")
)
))
))
Otherwise, you would need to perform filtering via XPath on the search results.
cts:search(doc(),
cts:element-word-query(xs:QName("primaryie"), $textname, "case-insensitive")
)[book/(beginpage or processing-instruction("docpage") = 'num="i"')]
This would require filtering(reading through the matched docs), so how quickly this query responds will depend upon the number of documents that are returned from the search criteria, and the limits you place on how many docs to return.
Upvotes: 2