Advanced search techniques

In most instances the article Using Search describes the use of search to the degree needed for day to day use but there are many ways to extend OrgVue's search capability.

Before progressing to the detail, there is some advice about advanced search:

  • search is at its most powerful when simple techniques are used, so typically start with a simple expression and make it more complicated only if you have too many results returned
  • because search is greedy in that it will try to find as many results that match as possible, often more results will be returned than you expect
  • most effective search is using letters, also numbers but avoid punctuation or special characters
  • search can readily misunderstand property keys which have spaces. Preferably do not use spaces in property keys but otherwise substitute underscores for spaces

place_of_birth:brighton instead of place of birth:brighton

If combining search expressions, the behaviour is always AND never OR

grade:=<5 dept:Finance

Note that if combining search expressions, arithmetic functions work e.g. >, >= etc. but there is no concept of NOT. 

Search is greedy in that it will return as many results as it can that match (this can be useful for speed). If my only department that contains an h is hr

dept:H will return the same results as dept:HR

but beware that e.g. jobtitle:hr would match on paleoanthropologist, so you may need to include word boundaries in your search criteria: see below.

Combination searches using single or multiple search criteria: it is possible to use OR in an expression: to search for nodes based in location Bournemouth or Worthing, use the pipe | symbol

location:Bournemouth|Worthing

It is possible to use ranges in an expression: to search for nodes associated with grades between 5 and 6, use the .. notation

grade:5..6

It is possible to use mathematics symbols in an expression i.e. >,>=,<,<=

salary:>=25000

All variants of the search function can be used in combination, separated by a space, which are interpretted as AND

location:Bournemouth|Worthing grade:5..6

Search leveraged by word boundaries

If I want to search all employee who have HR in their job title, we need a mechanism to only find ‘hr’ as a word in job title such that e.g. NOTanHRrole will not get picked up in the search, and word boundaries are the solution:

jobtitle:\bhr\b

The regex character \b enforces that words are bounded by non-words, which in practice are sentence beginning, sentence end, or a space, therefore the search string will match on e.g.

  • Head of HR
  • HR Manager

If more information on word boundaries is of interest, please follow this link.

Addendum

Similar to the word boundary example above, if you try to search on:

gender:male

This will not work, because the word female also includes 'male' so results will include nodes that reference both gender male and gender female.

There is a special character ^ that can be used in this case which is interpreted as 'begins with' so to search on

gender:^male

will return only those values that begin with male i.e. not female.

However this also a good example of where an overcomplex search expression is probably better implemented as a filter ...

Have more questions? Submit a request

Comments