Share via


How to refine search results to show only web pages on initial results page?

Question

Wednesday, June 15, 2016 12:52 PM

Just starting to work with 2013 search. Lots to pick up from 2010.

Our standard results page used to only show a search scope that showed web pages only.

Using an out-of-the-box page within the new search center stuff, I get a results area that will show pages, docs, people, etc.

I've looked at the Refinement panel on the page, and can make it show choices for FileTypes... but I can't figure out how to either set that panel to default to the web page filetype for first load of the page.... or how to tell the search results area to only show web pages on first load.

Anyone able to point me at a good walkthrough that would cover this concept?

I have also played with the Result Sources in Central Admin... but haven't got this figured out.

All replies (8)

Wednesday, June 15, 2016 3:53 PM âś…Answered

update... the search term is working... and hell, it probably worked as a result source.... but .... using WebPageLibrary against the search terms doesn't get many hits.

Conversely... I just tried {?{searchboxquery} FileType=html}   and it seems to get me more to where I need to be.

Thanks for your help... I'm gonna continue to trudge through the muddy waters of Search :)


Wednesday, June 15, 2016 2:50 PM

Hi,

i understand that what you need is to limit the results to a result type only.

have a look at this link: 

https://social.technet.microsoft.com/Forums/office/en-US/24b337e5-7f7e-4177-ad5e-c52b18981b89/how-to-display-only-wikipages-in-search-result?forum=sharepointsearch

Don't use the ContentTypeId parameter use this one:   contentclass:STS_ListItem_WebPageLibrary

You'll get only list items from WebPage libraries -> WebPages.

Hope it helps,

best regards.


Wednesday, June 15, 2016 2:59 PM

Think I'm on the right track... and that link does help.

Two things killing me now....

when you put in the query

{SearchBoxQuery} contentclass:STS_ListItem_WebPageLibrary

it will bring back results  if you don't have a search term.  It will show everything that matches that contentclass part of the query.   I need to get it so that if there isn't a search term, it won't return results

Second thing... the FileType query.... I can't find a listing of valid filetypes you can use here.  some things seem to work litteraly like file extensions (doc, pdf)  and others must specify a broader range (html brings back all web pages...even if they are aspx.... conversely aspx won't return anything).


Wednesday, June 15, 2016 3:02 PM

Have a look at this link:

http://sharepoint.stackexchange.com/questions/95541/sharepoint-search-prevent-showing-results-when-loading-page

it's what you need.


Wednesday, June 15, 2016 3:18 PM

Right track... but for some reason it won't give me results

I've tried

{?{SearchBoxQuery} (contentclass:STS_ListItem_WebPageLibrary)}    with and without the parenthesis... I don't know if those are only needed when you make a combined pattern.

also...by default, since this query is being built in the Results Sources area of central admin, and since I'm making it for local sharepoint sites, not people results.... the query thing slaps a -ContentClass=urn:content-class:SPSPeople to the end of my strings... I'm wondering if that could be breaking it too

EDIT... well that damn result sources thing does add the problem.  by hanging that string on the end, it breaks the query.  need to find a way to make a clean source that doesn't try to add the content-class limiter after the other query

Edit 2... and I've still got issues.   gonna take more investigation


Wednesday, June 15, 2016 3:28 PM

Try to put that query directly into the Search Results Webpart  (Webpart settings -> Change query button) to see if that's what you need. 


Wednesday, June 15, 2016 3:34 PM

that's what I'm trying to do.... but something still isn't right.  THink I need to start over as it's possible I now have some part of the equation messed up and it's making nothing work.


Wednesday, June 15, 2016 3:38 PM

Use the Local SharePoint Resources , Results Source in your webpart to avoid a mistake on the Result Source that you have created before. And then use the query directly in the webpart.

It should work.