Yes they swell on other infections. It depends on the location and how much infection is traveling through your body. As OrionQuest stated the lymph system acts as a filtering system and traps foreign bodies within them, causing them to swell.
Lymph nodes is where lymphocytes are stored, it that simple.
It's not a "filtering system" for debris ))))
When there is an infection lymphocytes begin to replicate in order to fight it - that's why lymph nodes swell up.