8

I have two content types, softs ct and softs ct page having parent content types item and page .

I managed to display results from custom list which is having softs ct but it doesn't display results from softs ct page.

I have tried with ContentType:'softs*' but it only shows results from one content type. How can I get from both content types?

Here is my search query

var query = appweburl + "/_api/search/query?querytext='ContentType:softs*'&selectproperties='Title,DueDate,ExpiryDate'&sortlist='LastModifiedTime:descending'";
  • how about only 'softs ct'? – Pantani Jan 7 '16 at 14:29
  • no it dont give results . i have tested on search query tool also . when i choose the source parameter "local sharepoint results" it display results but just from softs ct not from softs ct page.... and when i change the source to "Pages" then it display from 'soft ct page'. – meer Jan 7 '16 at 14:39
6

Are you sure that your softs ct page results have been crawled?

Also, you might want to try using the OR operator to specify both ContentTypes on a Result source and then reference it on your URL:

{{searchterms} ContentType:A OR ContentType:B}

var query = appweburl + "/_api/search/query?querytext='ContentType:softs*'&selectproperties='Title,DueDate,ExpiryDate'&sortlist='LastModifiedTime:descending'&sourceid='40f080a5-da63-4dce-b33a-fdad0dc83d1c'";

You can also try adding SPContentType to your refinementfilters:

var query = appweburl + "/_api/search/query?querytext='yoursearchterm'&selectproperties='Title,DueDate,ExpiryDate'&sortlist='LastModifiedTime:descending'&sourceid='40f080a5-da63-4dce-b33a-fdad0dc83d1c'&refinementfilters='SPContentType:(%22Download%22)'";

You might need to specify a QueryTemplatePropertiesUrl on that URL:

QueryTemplatePropertiesUrl='spfile://webroot/queryparametertemplate.xml'

More on that on Waldek's post.

You might find this tool useful:

https://sp2013searchtool.codeplex.com/

  • Hei i have tried in search tool but seems not working . I have same parameters in both content types soo its already been crawled. strange thing is it display results but just from one content type which is "soft ct" . can u share with me any screenshot from query tool how did u try to get results from both content types. – meer Jan 8 '16 at 8:53
  • thank u Lucas i made that work with source id and query text as contenttype:soft* – meer Jan 8 '16 at 14:07

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.