You add another attribute to all the entities on the database as being either Fed/Klingon/neutral set them all to neutral. Then over time sort them in their correct category.
The only flaw I see with that is say you get a new Faction at a later date, like Romulan. Romulans might share some items with Klingons but not with the Federation so you end up with the values of Fed/Klingon/Romulan/Klingon-Romulan/Neutral.
It might be easier to attach another entity with a list of boolean attributes showing which faction they should show for.
It also begs the question of why the same wasn't done to the Boffs as well. It's bad enough searching through reams of Aceton Beam III to find an Aux to Sif III officer although I can understand the difficulties there as each officer has several powers, not just one, but having to trawl through many of the wrong faction's just icing on the cake.