Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Web CMS (TeamSite)
Complex Searching with WorkSite 8.x API
guido1
I've got 2 questions regarding searching via the API
Firstly, we're trying to execute a "complex" search to return documents of a certain class which have not been added to a specific virtual folder.
For example, for client ABC123 and matter 9876 we would like to identify all LETTER-type documents that do not exist in a the Correspondence document folder of the ABC123-9876 workspace.
Is there a way to express this with the API? Currently it seems like a no-go
An abridged version of my code looks something like
// CODE SNIPPET STARTS
IManage.ManAndQuery query = new IManage.ManAndQueryClass();
query.AddFieldQuery(IManage.imProfileAttributeID.imProfileClass).Values.Add("LETTER");
IManage.IManFieldQuery fldQuery = query.AddFieldQuery(IManage.imProfileAttributeID.imProfileCustom1);
fldQuery.Values.Add("ABC123");
fldQuery = query.AddFieldQuery(IManage.imProfileAttributeID.imProfileCustom2);
fldQuery.Values.Add("9876");
IManage.IManDocuments results = (IManage.IManDocuments) sess.WorkArea.SearchDocumentsEx(dblist, query);
if (! (results.Empty))
{
IManage.IManDocument doc = null;
for(int counter=1; counter<=(results.Count); counter++)
{
doc = (IManage.IManDocument) results.ItemByIndex(counter);
// ... etc
// CODE SNIPPET ENDS
At this point I could possibly iterate over the Folders collection property of each IManDoc and query the AdditionalProperties, or whatever i need, but I'm wondering if anyone can think of a way to more optimally perform this kind of query
My second question relates to the ManStrings object: is there a limit on how many strings I can add to the collection before it keels over? Is it memory dependent?
If I can't find an elegant way to solve the first question I may have to consider querying client codes in blocks, as some of the databases have up to 40000 client codes to iterate over. In other words, my code might look something like:
// CODE SNIPPET STARTS
IManage.ManAndQuery query = new IManage.ManAndQueryClass();
query.AddFieldQuery(IManage.imProfileAttributeID.imProfileClass).Values.Add("LETTER");
IManage.IManDatabase db = sess.PreferredDatabase;
// query all Custom1 values in the database
IManage.IManCustomAttributes attribs = db.SearchCustomAttributes("", imProfileAttributeID.imProfileCustom1, imSearchAttributeType.imSearchID, imSearchEnabledDisabled.imSearchEnabledOrDisabled, true);
foreach (IManCustomAttribute attrib in attribs)
fldQuery.Values.Add(attrib.Name);
IManage.IManDocuments results = (IManage.IManDocuments) sess.WorkArea.SearchDocumentsEx(dblist, query);
// CODE SNIPPET ENDS
thanks in advance for any suggestions
Find more posts tagged with
Comments
jny
Would it be easier to do a search-within? That is, first get the target folder id (via the SearchFolders method) then build a search params for the SearchDocuments method that has the docclass, client, matter, and containerID (the folder id).
guido1
thanks for the response - I don't think that'll work in my case.
I want to return all documents of a specified class that do
not
have a container
for each of those documents I'd like to add them to a workspace's sub-folder container, determined by that document's custom1 and custom2 values
jny
I see. Unfortunately, there isn't a way to perform a Not query via complex searching.
Btw, the IManStrings has no limit.