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.

  • Remove AND from the query – Gautam Sheth May 12 '17 at 15:42
  • Thanks Gautam. But I want it to AND with the search box terms. How will that help? – Dixit Mirza May 12 '17 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. – Gautam Sheth May 12 '17 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? – Dixit Mirza Jun 10 '17 at 18:55
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

  • hi @DixitMirza, could you please accept this as answer so that it wont show up in the unanswered section, thanks :) – Gautam Sheth Jun 14 '17 at 11:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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