Advanced file search

Top  Previous 

The Advanced Search function allows you to search on attributes other than the file name in Easy PDF Explorer.

 

To start the Advanced Search function, click on the Advanced Search icon on the bottom of the Explorer window.

 

ee_advsearch01

 

This brings up the Advanced Search window where you enter your search value.

 

ee_advsearch08

 

 

Every file has attributes that you can use to search on.  The common attributes are accessible directly by using the appropriate function e.g. Name to retrieve the file name, Size to retrieve the file size, Created to retrieve the file creation date and so on.  Each function is listed in the Functions window, and clicking on a function will bring up the instructions on how to use the function.

 

Let's start with something simple.  Say we want to search only for files smaller than 1 MB, which is 1048576 bytes.  To perform that search, we use the following search value:

 

Size < 1048576

 

That's all there is to it.  Easy PDF Explorer will now search for all files smaller than 1048576 bytes and display them in the Search results window.

 

You can combine search values using the keywords AND, OR, and brackets.  Say we want to search for files smaller than 1048576 bytes, and where the file name contains the text 2019.  This is how we would write the search value:

 

(Size < 1048576) AND (NameContains('2019'))

 

Note that each search value needs to be enclosed in brackets, and that a text value needs to be enclosed in single quotes i.e. '2019'.  Numbers need not be enclosed in single quotes e.g. like the value 1048576 in the above example.

 

 

Working with dates and time

 

Dates are a little difficult to work with due to the many ways we can write a date depending on your locale and regional settings.  If you need to search on dates and time, you will need to use the EncodeDateTime, EncodeDate and EncodeTime functions.

 

Let's say we want to search for files last modified after January 14, 2019 3:20 PM.  The search value would be written this way:

 

Modified > EncodeDateTime(2019, 1, 14, 15, 20, 0, 0)

 

The EncodeDateTime function converts 7 numerical values to a timestamp, where the 7 values represent the year, month, date, hour, minute, second, and milliseconds respectively.

 

If the time element is not important, you can just use the EncodeDate function i.e.

 

ModifiedDate > EncodeDate(2019, 1, 14)

 

This will return all files modified after January 14, 2019 12:00 AM. EncodeDate takes only 3 parameters - the year, month, and date values.

 

If you want to search for files modified after a specific time, use the EncodeTime function.  For e.g. say we want to search for files modified after January 14, 2019, and only files modified after 9 PM.  This is how we would write the search value:

 

(ModifiedDate > EncodeDate(2019, 1, 4)) AND (ModifiedTime > EncodeTime(21, 0, 0, 0))

 

EncodeTime takes 4 parameters - the hour, minute, second, and milliseconds value.  The second and milliseconds value are optional, so you could also write the search value like this:

 

(ModifiedDate > EncodeDate(2019, 1, 4)) AND (ModifiedTime > EncodeTime(21, 0))

 

 

Extended attributes

 

In addition to the normal file properties, you can also search based on the file's extended attributes.  To see which extended attributes are available on your system, right click on the column header in the explorer window to bring up the list of available columns:

 

ee_advsearch03

 

and click on the More... item.  The list of extended attributes are then displayed (note that this is not the same as a PDF file's attributes).

 

ee_advancedsearch11

 

To search an extended attribute, use the Attribute function e.g.

 

Attribute('Width')

 

returns the Width attribute (if available) of the file.  So if the file is an image file, a value will be returned.  On our system, the Width attribute is displayed with a pixels suffix i.e.

 

ee_advsearch05a

 

So if we wanted to search for image files with a width of 3968 pixels, we would need to use this search value:

 

Attribute('Width') = '3968 pixels'

 

We can also return the attribute as a number using the AttributeAsNumber function e.g.

 

AttributeAsNumber('Width')

 

This function attempts to return the attribute's text value (in this case '3968 pixels') as a numerical value (3968).  If the attribute value cannot be converted to a number, a value of 0 is returned.

 

Now that we can get the width attribute as a number, we can easily apply range checks to it e.g.

 

AttributeAsNumber('Width') > 3776

(AttributeAsNumber('Width') > 3776) OR (AttributeAsNumber('Width') < 1024)

(AttributeAsNumber('Width') > 3776) AND (AttributeAsNumber('Height') > 2048)

 

Extended attributes allow you to perform some very advanced searches.  For example, say we have the following Excel files:

 

ee_advsearch07

 

We can search on the Authors and Subject attributes easily in Easy PDF Explorer.  E.g.

 

Attribute('Authors') = 'Yeoh Ray Mond'

 

will return all files created by 'Yeoh Ray Mond'.  If we want to search for all files containing the word 'Financials' in its subject, we will need to use the TextContains function in addition to the Attribute function.  The Attribute function returns the full value of the specified attribute, so for the first file, it will return 'Financials for April 2019'.  We could write the search criteria like so:

 

Attribute('Subject') = 'Financials for April 2019'

 

but it will limit our search to only the first file.  In this case, we want to return the third file too.  To do that, we use the TextContains function e.g.

 

TextContains(Attribute('Subject'), 'Financials')

 

TextContains takes 3 parameters.  The first parameter is the value to search in.  In this case, it will be the value of the Subject attribute.  The second parameter is the value to search for, in this case the word 'Financials'.  The third optional parameter is to indicate if the search is case-sensitive.  The default value is false, so you could write the search criteria in any of these ways:

 

TextContains(Attribute('Subject'), 'Financials')

TextContains(Attribute('Subject'), 'financials')

TextContains(Attribute('Subject'), 'finanCIALS')

 

To perform a case sensitive search, pass TRUE in the third parameter e.g.

 

TextContains(Attribute('Subject'), 'Financials', TRUE)

 

There are also 2 additional text functions, TextStartsWith and TextEndsWith, that checks if the text starts or ends with a specific value respectively, and accepts the same parameters as TextContains e.g.

 

TextStartsWith(Attribute('Subject'), 'Financials')

TextStartsWith(Attribute('Subject'), 'Financials', TRUE)

TextEndsWith(Attribute('Subject'), '2019')

 

The ability to search on extended attributes opens up a lot of possibilities  If you encounter any issues using the search function on extended attributes, please do drop us a line at support@yohz.com.