You are here:  » Can't get filters to work...


Can't get filters to work...

Submitted by ccgale on Wed, 2013-08-14 14:18 in

I am trying to set up a female clothing store, but my feeds have a lot of men's and kids clothes so am trying to remove these with filters.

I have created a filter with the following Drop Record Product Name (TEXT/NAME) and used Men's (also tried Mens and Men39s which is how ' is displayed in the title). Upon updating the feeds I still have the men's shoes on my website.

Submitted by support on Wed, 2013-08-14 20:11

Hi Carl,

Did you mean to apply the filter to the Category field not Product Name? If not, could you perhaps let me know a product page URL of a product that you are trying to drop, and better still, if you could let me know the filename of the feed as it is saved in your /feeds/ folder, I will fetch the feed (if that's OK) to my test server and look at exactly how the data is encoded and from that will be able to advise what to use in the filter (and against which field).

You are making great progress with the script in such a short time - these are data issues and you have the best tool-set at your disposal to help you work around this kind of scenario, Not only are there multiple ways that apostrophes can be encoded, where "Womens" and "Mens" have to be differentiated will probably require the RegExp version of the Drop Record filter so that it can be applied to whole words - I just need to see the raw data in order to be able to advise...

Thanks!
David.
--
PriceTapestry.com

Submitted by support on Thu, 2013-08-15 08:36

Hello Carl,

I was having another think about this and done a couple of tests and I think it's best to use Drop Record RegExp (the Regular Expression version which is far more flexible) and consider the beginning of whole words only using the word-boundary feature of regular expressions, and then dropping anything with any word beginning with (not case sensitive) "Men". This avoids any kind of issues around apostrophe encoding or whether or not an apostrophe exists at all.

To do this, instead of the base Drop Record filter, instead add a new "Drop Record RegExp" filter to the required field - either Product Name or Category, whichever for any given feed is where you find "Men['s]" and then in the text box on the configuration page for the filter, enter:

/\bMen/i

The "\b" is a word boundary anchor so it will match " Men" anywhere in the field, as well as "Men..." when it occurs right at the start. The "/" are delimiters which are required in more complex regular expressions so that flags can be added after the closing delimiter, and in this case the "i" flag makes it case insensitive.

Cheers,
David.
--
PriceTapestry.com

Submitted by ccgale on Fri, 2013-08-16 15:47

Thanks, will test it. Could the filter also be used to remove records which have no product description?

Submitted by support on Fri, 2013-08-16 16:29

Hi Carl,

Sure - RegExp to match "nothing" is:

/^$/

Cheers,
David.
--
PriceTapestry.com

Submitted by ccgale on Fri, 2013-08-16 16:47

Thanks, again