cancel
Showing results for 
Search instead for 
Did you mean: 

Use AddCustomQuery and AddDocumentType methods on same DocumentQuery object?

Kevin_Buse
Champ on-the-rise
Champ on-the-rise

Is it possible to create a documentquery object, add a custom query, and then add individual document types to the query? For ex.  

docQuery.AddCustomQuery(customQ);docQuery.AddDocumentType(docType1);docQuery.AddDocumentType(docType2);docQuery.Execute();

Is this situation valid? 

And if you added keywords to this query, would the keywords need to be common across all of the document types involved?

What would happen if you added a keyword onto this query that was only assigned to one of the document types involved and is therefore not common across all document types?

 
1 ACCEPTED ANSWER

Adam_Kuhn
Star Collaborator
Star Collaborator

Hi Kevin --

The answer to this would depend upon the Custom Query. What is the type of Custom Query being used in this example?

View answer in original post

4 REPLIES 4

Adam_Kuhn
Star Collaborator
Star Collaborator

Hi Kevin --

The answer to this would depend upon the Custom Query. What is the type of Custom Query being used in this example?

What would be your answer if the custom query was either of the following two types of custom query.

By Document Type

And

By Keyword

????

So -- DocumentQuery objects are meant to be as inclusive as possible given their parameters. That means that anything you add to one will be included additively unless otherwise specified (as in adding a keyword to the query where the KeywordOperator is set to "NotEqual"). In either case you've described, you're likely to get different results based on the particulars of the CustomQuery you've configured, but it should not cause any errors.

An important effect of this design choice is that if you add, for instance, a document type group to a document query, and a keyword constraint that only appears on certain documents in the document type, you will get *more* results than you expect.

Kevin_Buse
Champ on-the-rise
Champ on-the-rise

What would be your answer if the custom query was either of the following two types of custom query.

By Document Type

And

By Keyword

????