Collection picking up objects from second plone site (same server)

I have what seems to be an unusual situation. I had started two Plone sites on the same instance of Plone 5 (e.g., example.com:8080/Plone/first and example.com:8080/Plone/second ). The idea was that I would develop the two (with some similar, and some dissimilar content) with different themes. Such was the plan, and it largely worked for development purposes. I picked one over the other and set the site such that (e.g.) example.com/ --> example.com:8080/Plone/second .

The downside is that when I have a collection on the second site that is picking up objects from the first site. That wouldn't be a bad thing except for the fact that when there are two identical objects (one in first as well as second) then the collection lists both objects.

I revised the collection to look in only one location. Unfortunately, there is an identical location in the first site, so I still get duplicate entries.

Is there a way to force the collection to look only at one of the Plone sites? Frankly, I never thought that this would be a problem. I thought that the two sites would have had separate catalogs.

A collection is always looking only at one site, more precisely at one catalog. Almost surely, your problem is that the catalog has not only content objects from one site but also from a second one, probably because it was copied from that site's portal_catalog.

I recommend to use a script that loops over the catalogued objects and uncatalog_object all those not belonging to the site. Alternatively, you can clear and rebuild the catalog.

It seems you do not have two Plone sites but you have 2 folders within one site called Plone. Without a location criteria, then the collection will search for all items within your Plone site. If you already have a location criteria, perhaps you misconfigured it.