Filter based on URL or strings based on partial matches

Hi,

I am trying to implement filter thru JS. How do we do filter based on string, text functions like begins, contains, partial match etc.

e.g. I would like to filter based on if the URL contains the path /data-sheet/ or URL starts with ‘http://www.abc.com /data-sheet/’. I was thinking something like this, but it does not work.
filters: {‘page’: {‘url’: ‘*/data-sheet/*’}}

I would like a solution without using meta tags. (1. Some pages i can’t add meta tags since they are externally sites 2. others are file URLS (http://www.abc.com /data-sheet/product1.pdf)

1 Like

Hi Trevor,

At the moment it’s not possible to filter results based on url path matches. For the domains you do have control over we recommend the use of metatags to create custom fields. For those that you don’t have control over, we can assist in extracting values that you can filter by as long as there is a consistent path structure for those additional domains.

Please reach out to us via the Support form in your Swiftype dashboard and we can discuss further. :slight_smile:

I need to constraint the searches to include only sub-domains. this could be a name like */xxx.yyy/*, but also /xxx/yyy/zzz/ (paths). I want this filtering on the ‘url’ field of the ‘page’ document type.

Inserting meta-tag on pages is a no-go! We have hundred thousands of pages to index, so it will be too huge a task to insert meta-tags. It should be very easy to instruct Elastic Search with using regular expressions on the ‘url’ field.

When is this feature coming to Swiftype?

1 Like

It still will require that filtering be done from a configured key/value pair. In order to define those parameters at the document level without affecting your template markup, there is an advanced extraction tool that is currently available to customers on our Premium Plans.