How does search work for Published(expired) articles

While searching for pages in enonic. I am getting “Content not found error” in the search results for the expired pages. How to avoid the expired pages in search. I have already given branch: master in the search query.

Enonic version: 6.14.3
OS: MAC OS 10.13.5

You should exclude content that has no templates from your search, or treat it specially at least.

Content not found error is happening because the content which was published has expired but not been unpublished. Is that a bug in enonic? Shouldn’t the expired contents be unpublished automatically. Or is it related to search where it try to pick content from master…

I tried to reproduce with contentLib.getChildren and contentLib.query without success. The expired contents are always filtered on master.
Could you copy how you search for contents?