Search for a text fragment

Sometimes it is useful to search for a text fragment, such as a sentence, a line, a paragraph or a whole document. For this purpose, one can use the functions sentence(), line(), paragraph() and document() called without arguments.

Syntax

sentence()

line()

paragraph()

document()

These functions have no required arguments. When called without arguments, they match all sentences, lines, paragraphs or documents respectively.

For more information about these functions, please see Unordered Proximity Search description.

Example

sentence() matches all sentences.

line() matches all lines.

paragraph() matches all paragraphs.

document() matches all documents.

case(upper, paragraph()) matches all paragraphs written in uppercase, for example, "SECOND CHANCE", "PROJECTED STARTING LINEUPS".

lemma(noun, line()) matches all lines composed only by nouns, for example, "Joe Biden Georgia rally", "Advertisement".

case(title, document()) matches all documents written in titlecase, for example, "Articles, Offers & Useful Resources", "504 Gateway Timeout".

length(2, 5, sentence(), count:=word) matches all sentences consisting of 2 to 5 words, for example, "Clearly affected his stock", "Traveling this summer?", "Don’t forget your mask".

Task example: Searching for newspaper headlines

In order to find newspaper headlines written in titlecase, the following query can be used:

case(title, sentence())

pdl fragment search en