Document searches

A search specifically for documents can be executed using the documents() query.

The arguments for the documents() query such as from, where, and orderBy in general follow the CE query SQL syntax for those parts of the SQL statement.

Handling single or joined class searches

The from argument can either specify a single class only or can also contain joined classes (but must include a document class). The argument is optional to query for the base Document class, and if not specified, will query against the base Document class.
{
  documents(
    repositoryIdentifier:"OS1"
    from:"Document"
    where:"[DateCreated] > 20180815T070000Z AND [IsCurrentVersion] = True"
    orderBy:"DocumentTitle"
    pageSize:20
  ) {
    documents {
      dateCreated
      id
      name
      majorVersionNumber
      minorVersionNumber
      mimeType
    }
    pageInfo {
      token
    }
  }
}

Handling document searches in virtual tables

If you defined a virtual table for an object store, you can use GraphQL to perform searches that involve virtual tables. For more information, see the topic Creating virtual tables.

The following example uses the GenAI::VectorSearch virtual table from the GenAI Extensions add‑on to perform a vector search. It uses a query that selects a single type of object, such as documents().

{
  documents(
    repositoryIdentifier:"p8os1",
    from:"GenAI::VectorSearch(Document, 'Legal Policy')"
    where: "Creator='p8admin' and VersionStatus=1"
  ) {
    documents {
      creator
      dateCreated
      lastModifier
      dateLastModified
      id
      name
    }
  }
}
Important: If you shape the output with properties in the general properties collection, you can select only properties on the document class. You cannot select virtual properties from a virtual table.

For more information, see the topic Relational query syntax for virtual tables.

Handling pagination in documents query

If there are more results than can be returned in a page, a non-null string is returned for the token field of PageInfo. The next page of results can be obtained by using moreDocuments().
{
  moreDocuments(
    token: "<insert_token>"
  ) {
    documents {
      dateCreated
      id
      name
      majorVersionNumber
      minorVersionNumber
      mimeType
    }
    pageInfo {
      token
    }
  }
}

The output data should be shaped the same way as the original documents() call. The specific properties being selected and the depth of any complex nested data is established in the original call and cannot be changed in the continuation call.