Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all articles
Browse latest Browse all 7589

How to capture the query using a web part in SharePoint 2013 Search?

$
0
0

Hi all,

Background:

I'm trying to build a feature into a standard search site by writing a custom Web Part that runs some analysis on a search query and displays the output on the side next to the results.

Problem:

I'm trying to figure out the best way I can capture the string that a user entered for the search, so that I can run the query myself on the search API (after modifying it), and use the results for the mentioned analysis, and output the analysis on my Web Part's .ascx page.

What would be your recommended architecture for achieving this? Could you please specify exactly how I can get the string that was involved in the query?

Approaches already explored:

  1. Extending ResultScript Web Part and overriding OnLoad to add my method to the After/BeforeSerializeToClient events (they never trigger and I'm not sure how to get the query string and display the result of my analysis).
  2. Adding a custom JavaScript method trigger to the search box (not sure how I can refer to the Web Part from the main search page, can only trigger it from the results page).

Thank you in advance - I appreciate any and all help and ideas.


Viewing all articles
Browse latest Browse all 7589

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>