Custom filters

Availability

Infradox XS 24 - all versions

Updates

15 October 2016, support for custom filters linked to specific API's 
7 November 2016, custom filters can be configured to be active (on) by default
16 January 2017, filters for category searches in the gallery manager

Related articles

Search filters and Gallery access control

Using dynamic subdomains

The metadata repository

Date range filters

Infradox XS URL's explained

Introduction

The Infradox XS search engine supports several standardized filters to help your clients in getting more specific search results. Furthermore, the filtering system is used for access control, to hide files from results e.g. to exclude files not available in a client's territory, to hide unpublished files or files that are to be seen by certain clients only - and so on. In addition to the standardized filters (media, image orientation, image type, rights, color, license type, release information and so on) - you can create a number of so called custom filters.

Generally speaking, it is a good idea to add unique codes to your metadata for filtering purposes. However, any word in any of the indexed fields can be used by the filtering system. The words / codes can be both in visible and invisible fields. For further information about configuring your data fields, read this article about the metadata repository.

You can create up to 10 custom filter sets and each set can have an unlimited number of filter codes. Here are a few examples of what the filtering mechanisms can be used for:

  • categories, e.g. people, natural history, fashion, celebrities, portraits, sports
  • price ranges, e.g. budget, mid range, premium
  • agents that you represent
  • content with specific characteristics, e.g. no nudity (NSFW / not suitable for work)
  • collections, e.g. vintage, phone photos, footage
  • and so on 

Changes for XS 27.5 or later:
You can also configure custom filters to include/exclude specific API's from being used in search queries. This is of course only relevant if your website supports multiple live API connections. More about this further down in this article. 

You can now configure custom filters to be "on" by default. This setting can also be used in conjunction with searching for latest files.

For information about how you can use the filters in URL's, please read Infradox XS URL's explained.

Changes for XS 28.2 or later:
You can now specify multiple values for the same custom filter in the Gallery manager when configuring Category search queries. For more info and examples, click the help link above the "filter codes" box in the Gallery manager.

An example using normal keywords as opposed to special purpose unique filtering codes

In this example, we have a photo archive and all photos have either the keyword "location" or the keyword "studio". We want our clients to be able to search within the location collection photos only, and to search for photos within the studio collection only. We also want to create links that allow our clients to browse all the new files for either the location or the studio collection.

This example assumes that are no custom filters yet.

Go to Site configuration and click Search settings in the bar on the left. Click on Custom filters to open this section. 

  • Tick the Enabled checkbox for filter #1. 
  • If you want this filter to appear in the Advanced search panel on the search page only, then leave the Quick search checkbox unticked. Otherwise, make sure to make your new filter appear in the quick search filters box by ticking Quick search.
  • For this example, leave the Filter mask input box empty
  • In the Label box, you must enter the filter's display name (localised). Each locale must be prefixed by its locale id and the = symbol. E.g. locale id 1 for English, 2 for Dutch. If your website supports English only, then you'll only have to input the display name in English. 
    Enter 1=Shoot,2=Shoot in the Label box (the same for both English and Dutch).
  • In the filters box, enter:

    location:1=Location,2=Locatie
    studio:1=Studio,2=Studio

    Note that the syntax is very important. Each filter is on its own line in the box.
    Each line starts with the actual filter code that will be applied to the search queries followed by a colon (:).
    The colon is followed by the localised display labels of each of the filters in the format id=label. For example 1=Location - where 1 is the id for English.

  • Using URI codes
    If you also want to create a URI code that can be used to browse the latest uploads with the filter code applied, then add the URI code that you want to use after the localised display labels. You may use letters only. Change the lines in the filters box to this:
    location:1=Location,2=Locatie,uri=locationshoots
    studio:1=Studio,2=Studio,uri=studioshoots

    In this example we have used the uri code locationshoots for the first filter, and the uri code studioshoots for the second filter. This means that you use the links /latest/locationshoots and /latest/studioshoots to browse new files with the appropriate filter codes applied. 

  • Displaying filters with URI codes as links
    If you have specified URI codes - as explained above - and you also want the filters to show as links that users can click to view the latest files matching the filter, then add link=1. For example:
    location:1=Location,2=Locatie,uri=locationshoots,link=1
    studio:1=Studio,2=Studio,uri=studioshoots,link=1

  • Marking a filter to be on by default (27.5 or later)
    Add on=1 to a filter to make it selected by default.
    For example:
    Infradox:1=Infradox API,APIIndex=0,on=1
    AGE:1=AGE API,APIIndex=1
    Note that you can not use both on=1 and on=0, use either one. 

  • Marking all filter to be on by default, with the exception of some filters (27.5 or later)
    Add on=0 to a filter to make it NOT selected by default, all other filters that do not have on=0 will be selected by default.
    For example:
    Infradox:1=Infradox API,APIIndex=0,on=0
    AGE:1=AGE API,APIIndex=1
    500px:1=500px API,APIIndex=2
    MF:1=Masterfile,APIIndex=3
    Note that you can not use both on=1 and on=0, use either one.
  • Linking filters to specific API's (27.5 or later)
    You can link a filter code to a specific API. This allows you to show such filters as normal filters in the search panel, and to use these filters to exclude or include specific API's from search requests. For instance if your website uses the infradox API to search your own database and it has a connection to the AGE api.

    Have a look at these example filter codes for a filter group that is created for collections that your website offers:
    500px:1=500px,APIIndex=0
    awl:1=AWL,APIIndex=0
    age:1=AGE,APIIndex=1
    rf:1=RF collection


    The content of the first two is in your own database and accessed with the infradox API (which has the index number 0). The content for AGE is retrieved via a third party API which has index number 1. If none of the above filters are checked, then all API's are used in the search query. If the filter 500px is checked then only API 0 will be used to search. If only the fitlter AGE is checked, then only API 1 will be used. If AGE and either 500px or AWL are checked, then both API's are used.  

    NOTE If the content for a filter code in your group can be used by all API's, then do not add the APIIndex= property to the filter (see RF example above). No APIIndex property means that if the filter is selected, all API's can be used and the filter code will be used as any other custom filter.

  • Not applying filter codes for filters that are linked to an API.
    If you have created a filter to simply limit searching to specific API's and you don't want the filter code to be actually used to search, then add ignore=1. For example:
    Infradox:1=Infradox,APIIndex=0,ignore=1
    999:1=AGE,APIIndex=1,ignore=1
    RF:1=AGE Royalty Free,APIIndex=1


    When e.g. the AGE filter is selected, searches include that API (APIIndex=1) but do not really apply the filter code value (999). When the RF filter is selected, searches include the API with index 1 and apply the search filter (RF) because it doesn't have ignore=1.
  • Finally, make sure that you have ticked the radio button OR for the Multiple filters are connected with option. This is explained later.

Scroll down and click Save to apply your changes. You can use the filters immediately. If a user ticks the Location checkbox in the filters box, files that do not have the word location will be excluded from his/her search results. 

Note with regards to the NSFW filter

Infradox XS has a standard filter built-in for NSFW files. If you want to use this filter, you'll have to create a custom filter for it, as described in this article. The code that you can use is @NSFW#

An example using special purpose unique filtering codes

To make sure that the filter codes are unique, you can add special codes to your meta data that you can use for filtering. In this example we are creating filters for 4 different price ranges, Budget, Mid price, High end and Exclusive.

Our metadata has the codes PRBU#, PRMP#, PRHE# and PREX#. We are using the # sign to make sure that these codes are unique and unlikely to exist as normal keywords or words in any of the other indexed fields. These codes are in field Custom 10 - and this field is indexed but not visible on the website. We are creating filter #2.

Go to Site configuration and click Search settings in the bar on the left. Click on Custom filters to open this section. 

  • Tick the Enabled checkbox for filter #2. 
  • If you want this filter to appear in the Advanced search panel on the search page only, then leave the Quick search checkbox unticked. Otherwise, make sure to make your new filter appear in the quick search filters box by ticking Quick search.
  • In the Filter mask input box enter PR[filter]#
    This value will be used to generate your filter codes by replacing [filter] with the active filter code. Further information below.
  • In the Label box, enter 1=Price range, 2=Prijsklasse 
  • In the filters box, enter:

    bu:1=Budget,2=Budget
    mp:1=Mid price,2=Mid price
    he:1=High end,2=High end
    ex:1=Exclusive,2=Exclusief
    In this example, the filter code for Budget is bu. If it's selected the code will be parsed into PRBU# because of the mask that we have created.

  • Note that the syntax is very important and that each filter is on its own line in the box. 
    Each line starts with the actual filter code that will be applied to the search queries followed by a colon (:). 
    The colon is followed by the localised display labels of each of the filters in the format id=label. For example 1=Exclusive - where 1 is the id for English. If you want to add URI codes then read the first example for more information.

  • Finally, make sure that you have ticked the radio button OR for the Multiple filters are connected with option. 

Scroll down and click Save to apply your changes. You can use the filters immediately. If a user ticks any of the Price range checkboxes in the filters box, only files that have the active filter codes are included in the search results. For example, if a user ticks Budget and Mid price, searches will only return files that have the codes PRBU# or PRMP#. 

About the option Multiple filters are connected with 

The OR option means that multiple filters are combined using the Boolean operator OR. If you look at the Price range example above, this ensures that files are returned if the metadata contains either the code PRBU# or the code PRMP# - with the filters Budget and Mid price ticked. If you select the AND option instead, then only files that have BOTH codes are returned.

Important

  • The filter mask must be either blank (empty) or it must have a mask with [filter] in it. The [filter] part will be replaced by the filter code.
  • Masks many not contain spaces. 
  • Filter codes must be unique within a filter group. E.g.

    pp:1=People,2=Mensen
    pp:1=Pets,2=Huisdieren
    is going to be a problem. 

Frequently asked questions

  • Can I hide the custom filters if a subdomain is active?
    Yes, change the settings of the subdomain and untick the checkboxes for the filters (1 through 5) that are not applicable for the subdomain.
  • I have created custom filters but they don't appear on the client facing pages
    This is most likely because the settings are incorrect or incomplete. Make sure that you have entered everything as described in this article.
  • My website uses only one user interface language, do I need to enter all locales?
    No, only the ones that you use. Remember to prefix each string with the correct locale id and  =  (e.g. 1= for English, 2= for Dutch)
  • I want to use custom filters but I don't use the filters drop down box for the quick search, is that possible?
    That's possible but then the filters will only show on the search page. If you have both disabled the advanced search panel and the quick search filter options, then the user has no means of applying any of the custom filters. Note that you select which filters you want to appear in the quick search box and the advanced search panel.
  • I want to create more than 5 custom filter groups, how do I do that?
    That's not possible. Try to combine more filters in a single filter group. The number of actual filters in each of the five groups is virtually unlimited.
  • When I search with one of my filters applied, I get more results than I expect. Why is this?
    1) It may be that the filter codes that you are using also exist in other indexed data fields. For instance, if you have a filter code people to filter images that have the word people in the subcategory field, this word may also exist in keywords or captions of other images that do not have the word people in the subcategory field. It is best to use uniquely coded information for filtering purposes as described above.
    2) There may be other filters active, either filters that you can see on the client facing pages or filters that you can't see. E.g. the ones that you are using for access control.
    3) If you're using a subdomain, make sure that the subdomain filters aren't causing the problem that you are experiencing.

 

Have more questions? Submit a request

0 Comments

Article is closed for comments.
Powered by Zendesk