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:

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

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

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

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

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

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:

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

The complete search query:

((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))))
CODE

For a simplified display we shorten the formal language:

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

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:

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

Begin to build the prefix notation:

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

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:

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

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

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

The prefix notation: 

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

3. Step

Look for the next level of brackets: 

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

Look for search terms:

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

The prefix notation: 

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

4. Step

Look for the next level of brackets:

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


Look for search terms:

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

The prefix notation: 

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

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:

OR 
	AND
	AND
CODE

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

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

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

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

Finally, add the condition for the target asset: 

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
CODE

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.