Link to home
Start Free TrialLog in
Avatar of Martin Griffiths
Martin Griffiths

asked on

How to view what values are passed through to a Search Query Variable from a web part

I have a web part on a page which uses a search result source with a {page.title} query variable. If I go in to search result sources and test it with a value it returns the correct results.

However, from the web part it returns zero results so there must be an issue with what the web part on the page is trying to pass to that query but I can't for the life of me work out how to view what that value is.

Is there a way of passing a value from the web part to the query variable?
Avatar of Noah
Noah
Flag of Singapore image

Hi there! :)

Please refer to the link below for more information on how to troubleshoot these type of issues.

Reference: https://blogs.technet.microsoft.com/tothesharepoint/2013/05/23/stage-10-configure-the-query-in-a-content-search-web-part-on-a-catalog-item-page/
Avatar of Martin Griffiths
Martin Griffiths

ASKER

unfortunately I don't get the option to change query in the web part tool pane. I guess this is because it's a custom web part. clicking on Edit Snippet I see this:

<script>
        (function() {
            var options = {"ID":"ppcWebparts5","title":"IT Team News","sourceNames":"All News:Legal,Social,Chief Executive;Department News:All","maxItems":4,"shortSummaryLength":250,"longSummaryLength":440};
            ppc.Core.loadPart2("NewsHub", options);
        })();
</script>

Open in new window


I've found the javascript file for this type of custom web part. Basically it parses the above and the one that fails is Department News as this is supposed to be configured to run the Department News result source.

From a more generic perspective though, this link you've given doesn't give me a method of what is being passed through from that page web part through to the query result source query variable. It's relatively easy to gather the URLToken values as you can see them at the top of the browser window. Not so easy with {page.title} for example which is what I'm trying to establish to be honest. It may well be the wrong variable I should be using.
Hi, are you querying some database? The webpart is it an SSRS report or what? I believe your answer will very depending on what technology your using inside this webpart. Hope that helps.
This question needs an answer!
Become an EE member today
7 DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.