Skip to main content
Skip table of contents

Expert search recipe

A comprehensive Expert search example that guides you to build the search step-by-step. 

Prerequisites

To use the Expert search, you need a deeper understanding of the data model in censhare and assets relations.

Introduction

You can use the Expert search to create complex queries. If you want to set up such a query, we recommend you take a systematic approach to build your search:

  • Write search terms in a formal language.

  • Use a hierarchical tree structure to put the query parts together.

  • Add search query blocks one-by-one in the Expert search dialog, starting with the top-level block.

  • Test each step in the Expert search and check if the results are as you expect.    

The following part guides you through the build process of a complex query step by step.

Example

This article shows how the following search is translated step-by-step into a formal query notation and entered in the Expert search dialog of censhare Web:

Search for images in the "World Publisher" domain and layouts that are planned for an issue. Additionally, layouts in the second domain “root” or "Nature Travel Magazine" are wanted as well.

Key steps

  1. Write down the search in the formal notation.

  2. Convert the formal notation into the prefix notation.

  3. Use the prefix notation to enter the query in the Expert search.

Formal notation    

In the first step, search for images in the "World Publisher" domain. The formal notation is:

CODE
(Type = Image) AND (Domain = World Publisher) 

Write the query for layouts that are planned for an issue:

CODE
(Type = Layout) 
	AND RELATION((Direction = Parent, Type = Planning) 
	AND Target(Type = Issue)))

Put the two queries together with OR to obtain the combined results of both:     

CODE
((Type = Image) AND (Domain = World Publisher)) 
	OR ((Type = Layout) AND RELATION((Direction = Parent, Type = Planning) 
	AND (Target(Type = Issue)))
        Write the additional conditions for the layouts: 
      
CODE
(2. Domain = Root) OR (2. Domain = Nature Travel Magazine)

Layouts must match one of the two conditions in addition to the conditions created before. Add the conditions to the second query with an AND:

CODE
(Type = Layout) 
AND ((2. Domain = Root) OR (2. Domain = Nature Travel)) 
AND RELATION((Direction = Parent, Type = Planning) AND (Target(Type = Issue)))

The complete search query:

CODE
((Type = Image) AND (Domain = World Publisher)) 
OR ((Type = Layout) AND ((2. Domain = Root) OR (2. Domain = Nature Travel))
AND RELATION((Direction = Parent, Type = Planning) AND (Target(Type = Issue))))

For a simplified display we shorten the formal language:

CODE
(Image AND World Publisher) OR (Layout AND (Root OR Nature Travel)
	AND RELATION((Parent, Planning) AND TARGET (Issue)))

If you have written down the simplified formal search query, transform it into a tree structure (prefix notation). This helps you to enter and create the query in the Expert search dialog.

Prefix notation

1. Step

First, identify the top-level query. Look for the operator that is not placed inside brackets:

CODE
(Image AND World Publisher) 
	OR 
(Layout AND (Root OR Nature Travel) 
AND RELATION((Parent, Planning) AND TARGET (Issue)))

Begin to build the prefix notation:

CODE
OR 
	(Image AND World Publisher) 
	(Layout AND (Root OR Nature Travel) 
	AND RELATION((Parent, Planning) AND TARGET (Issue)))
        

Proceed in the same way with each branch or query part. The transformation eliminates the brackets step-by-step.

2. Step

Look forthe next level of brackets:

CODE
(Image 
AND 
World Publisher) OR (Layout 
	AND 
(Root OR Nature Travel) 
	AND 
RELATION((Parent, Planning) AND TARGET (Issue)))
         

If there is no next level of brackets for a part of the search query, look there for the search terms:

CODE
(
Image 
AND 
World Publisher
) OR (
Layout 
AND (Root OR Nature Travel) AND 
RELATION((Parent, Planning) AND TARGET (Issue)))

The prefix notation: 

CODE
OR 
	AND 
		Image 
		WorldPublisher 
	AND
		Layout 
		(Root OR Nature Travel) 
		RELATION((Parent, Planning) AND TARGET (Issue))
        

3. Step

Look for the next level of brackets: 

CODE
(Image AND World Publisher) OR (Layout AND (Root 
	OR 
Nature Travel) AND
	RELATION(
(Parent, Planning) AND TARGET (Issue)))

Look for search terms:

CODE
(Image AND World Publisher) OR (Layout AND (
	Root 
OR 
	Nature Travel
) AND RELATION((Parent,Planning) AND TARGET (Issue)))

The prefix notation: 

CODE
OR 
	AND 
		Image 
		WorldPublisher 
	AND 
		Layout 
		OR 
			Root 
			NatureTravel 
		RELATION (Parent, Planning AND TARGET (Issue))

4. Step

Look for the next level of brackets:

CODE
(Image AND World Publisher) OR (Layout AND (Root OR Nature Travel) 
	AND
RELATION((Parent, Planning) AND TARGET (Issue)))


Look for search terms:

CODE
(Image AND World Publisher) OR (Layout AND (Root OR Nature Travel) 
AND RELATION(
	(Parent, Planning) 
AND TARGET 
	(Issue)
))

The prefix notation: 

CODE
OR 
	AND 
		Image 
		World Publisher 
	AND 
		Layout 
		OR 
			Root 
			Nature Travel 
		RELATION 
			(Parent, Planning) 
			AND 
				TARGET(Issue)

Enter the query

With the tree structure, you can create the search query in the Expert search dialog. Add the OR and the two AND operators inside:

CODE
OR 
	AND
	AND

Add the first parameters, the second OR operator and the RELATION:

CODE
OR 
	AND 
		Type = Image 
		Domain = World Publisher 
	AND 
		Type = Layout 
		OR
		RELATION

Enter the parameters for the OR relation and the first part of the RELATION:

CODE
OR 
	AND 
		Type = Image 
		Domain = World Publisher 
	AND 
		Type = Layout 
		OR 
			2. Domain = Root 
			2. Domain = Nature Travel 
		RELATION 
			Direction = Parent 
			Type = Planning 
			Target

Finally, add the condition for the target asset: 

CODE
OR 
	AND 
		Type = Image 
		Domain = World Publisher 
	AND 
		Type = Layout 
		OR 
			2. Domain = Root 
			2. Domain = Nature Travel 
		RELATION 
			Direction = Parent 
			Type = Planning 
			Target 
				Type = Issue

Result

You have written down an a complex search example in a formal notation. You have converted the formal notation into the prefix notation. Following the prefix notation, you have entered the query in the Expert search.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.