0

Thanks for your help.

I am trying to write a simple query in search results web part that looks like this: {SearchBoxQuery} AND ContentTypeId=completeidhere

However, the query returns results from everywhere. I have also tried ContentType with the name of the content type as well as the path property pointing directly to the document library.

However, in all the cases, it returns all the results.

Can someone please help out and share their thoughts?.

Thanks.

4
  • Remove AND from the query Commented May 12, 2017 at 15:42
  • Thanks Gautam. But I want it to AND with the search box terms. How will that help? Commented May 12, 2017 at 16:17
  • It will work with search box terms. This is ootb implemententation. You add AND only when required like limiting to 2 content types. Commented May 12, 2017 at 16:27
  • Hi Gautam, How do i mark your comment as an answer? It helped with your suggestion but I have no way to mark a comment as an answer. Can you post it as answer please? Commented Jun 10, 2017 at 18:55

1 Answer 1

0

As mentioned in comments, you need to remove AND from the query.

Your search query would like {SearchBoxQuery} ContentTypeId=completeidhere

This is OOTB implementation of SharePoint. You need to add AND only when you want to limit the results between certain conditions for example as below:

{SearchBoxQuery} ContentTypeId=completeidhere AND ContentTypeId=anothercompleteidhere

1
  • hi @DixitMirza, could you please accept this as answer so that it wont show up in the unanswered section, thanks :) Commented Jun 14, 2017 at 11:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.