There are many situations where some specific search profile could be useful. But it's not good to create many search profiles because their list tends to be cluttered.
There is some "general" search profile that uses the power of the repository.GetElementSet function below.
When you create the following Addin-search and add the search profile to use this addin-function you can use searches using direct SQL queries like:
select Object_ID from t_object where name like 'a%'
The SQL has to return the list of object_id (see help for repository.GetElementSet)
Search profile (Plugin COM object is called EAPlugins)
<Search Name="Find By SQL" GUID="{371E2601-771A-4d70-9030-918A0167AAD1}" PkgGUID="-1" Type="0" LnksToObj="0" CustomSearch="1" AddinAndMethodName="EAPlugins.findBySQL"><SrchOn/><LnksTo/></Search>
Plugin code (C#):
public Boolean findBySQL(EA.Repository rep, String searchString, out String XML)
{
XML = @"<ReportViewData>
<Fields>
<Field name=""CLASSGUID""/>
<Field name=""CLASSTYPE""/>
<Field name=""Name""/>
</Fields>
<Rows>
";
EA.Collection col=null;
try
{
col= CommonUtils.repository.GetElementSet(searchString, 2);
if ((col.Count == 1) && (col.GetAt(0) == null)) { } //this temporarily solves the bug in EA where an empty Set gives Count 1
else
{
foreach (EA.Element elem in col)
{
XML = XML + "<Row>\n";
XML = XML + "<Field name=\"CLASSGUID\" value=\"" + elem.ElementGUID + "\"/>\n";
XML = XML + "<Field name=\"CLASSTYPE\" value=\"" + elem.Type + "\"/>\n";
XML = XML + "<Field name=\"Name\" value=\"" + elem.Name + "\"/>\n";
XML = XML + "</Row>\n";
}
}
}
catch (Exception) { }
finally {
if (col!=null)
System.Runtime.InteropServices.Marshal.ReleaseComObject(col);
col = null;
}
;
XML = XML + @"</Rows>
</ReportViewData>";
return true;
}