The Finder is an essential part of the Scripting API and the basics are well described in the scripting guideline. So this topic outlines a few things that go beyond the official guide.
Function findByType
The findByType function requires a mandatory type as first argument and a bool value strict as second argument. The second is optional. So in most cases you can call the function with just a class from the Metamodel like:
finder.findByType(Metamodel.sysml.SySMLPart);
// same as ...
finder.findByType(Metamodel.sysml.SySMLPart, false);
As you can see, the second arguments defaults to false, meaning the finder will return all direct instances of the given type and all derived types. In most cases this will work for you, however, there are a few use cases where you want to set strict to true.
// just packages
finder.findByType(Metamodel.sysml.SysMLContainerPackage, true);
// packages, but also parts, blocks etc.
finder.findByType(Metamodel.sysml.SysMLContainerPackage, false);
The example shows that a search with a type like container package may return different results, depending on the strict parameter. If you do a strict search you will only find real packages. If the query is not strict, also parts and other elements may be returned because they inherit from SysMLContainerPackage. Check the metamodel guide for inheritance or ask questions in this topic.