Explore > Queries > Compound query

Compound query

Compound queries can help you to find content in your files that is close to other content. For example, you can:

  • Combine a text search and coding query to search for text in or near coded content
  • Combine two text searches to search for content where one term precedes another
  • Combine two coding queries to search for content coded to one code near content coded to another.

Create a compound query

  1. On the Explore tab, in the Query group, click Compound.
  2. Under Search for content matching select options from the lists:
    1. Subquery 1 select the first query type and then click Criteria—refer to Text Search query or Coding query for more information on building the criteria.
    2. NEAR Content select a coding search operator such as AND. If you chose the NEAR or PRECEDING Content, you can specify the options for proximity and retrieval.
    3. Subquery 2 select the second query type and then click Criteria—refer to Text Search query or Coding query for more information on building the criteria.
  3. (Optional) Set the scope of your query:
    • From the In list, select the items you want to include in the query—click the Select button to select the project items.
    • From the Where list, you can specify to search project items created and/or modified by any or selected users—click the Select button to select the project items.
  4. Click Run.


  • To save query settings so you can run the query again later, check Add to project at the top of the dialog box. Name the query and optionally give a description in the General tab that opens.
  • Define spread coding options (the amount of coding spread around the search word) on the Query Options tab.

Understand the results

By default, the results of a compound query are displayed in the Detail View (the Reference tab is in focus—you can change this default to the Summary tab in Application Options, Display tab Application options).

Reference tab in Detail View.

Click the tabs on the right to see matching content that has been coded in text (documents, memos and externals), audio, video, picture or dataset files.

If you include an 'aggregate' code in the scope of a query, content coded to the code and all its direct children is included in the results.

Save results as code, static set, or in Query Results folder

If your query has returned interesting content, you may want to save it so you can explore it further. For example, you might have found all the content coded to water quality, that contains the term agriculture and want to review it later. You can save it to a code, static set, or in the Query Results folder.

A code you create will contain the content displayed on the Reference tab in the query results. If you repeatedly run the same query you may want to merge the references into an existing code, rather than create them as a new code.

  1. Click on the query results in the Detail View.
  2. On the ribbon Code tab, click Store Query Results / Store Query Results.
  3. From the Option list, choose what you want to do with the results—as a new code or case or merged into an existing code or case; as a new static set or merged into an existing static set; or independently in the Query Results folder.
  4. Enter a name and optionally description and click OK.


  • By default new codes are created in the Query Results folder, unless you choose another location. Manage query results
  • If you save the results as a code hierarchy, relevant content from each file is coded to a separate code, under a parent code.
  • You can choose how you want to store the results before you run the query—by setting your preferences on the Query Options tab in the Compound Query dialog box.