Exclude by Field REX for dates

josh104
Posts: 24
Joined: Mon Oct 09, 2006 5:39 pm

Exclude by Field REX for dates

Post by josh104 »

A few months ago you guys provided a great REX for making the modified date the same as the date mentioned within indexed articles.

Data From Field:
Search: >>\alpha+ =\digit{1,2}[^,]{0,2}, =\digit{4}
Replace: \1\2\3\5\6
Field: Text
Which Field: Modify Date

This worked excellently, but since the fixed dates only pertained to sort by date, and that didn't consider relevancy, we decided to instead try to only index articles written in the past year or so. In order to accomplish this, we tried to use the REX previously provided and modify it for the Exclude by Field settings as follows:

Exclude by Field:
Query: />>\alpha+ =\digit{1,2}[^,]{0,2}, =\digit{3}[0-5]
Field: Text
Exclude: Pages Only

AND

Query: />>\alpha+ =\digit{1,2}[^,]{0,2}, 19=\digit{2}
Field: Text
Exclude: Pages Only

However, this does not seem to be working. Any suggestions on how to correctly implement this, or on a better way to restrict articles to only ones with a date of 2006 or 2007?

Thank you.
User avatar
mark
Site Admin
Posts: 5519
Joined: Tue Apr 25, 2000 6:56 pm

Exclude by Field REX for dates

Post by mark »

Looks basically ok. But in the metamorph query spaces separate terms so you need to quote the whole thing or use \x20 for space.

"/>>\alpha+ =\digit{1,2}[^,]{0,2}, =\digit{3}[0-5]"
/>>\alpha+\x20=\digit{1,2}[^,]{0,2},\x20=\digit{3}[0-5]\

I personally like the \x20 because the spaces are hard to read.