Gravatar for jed_dube@cree.com

Question by jdube, May 20, 2014 11:29 AM

Can I modify or remove query string parameters displayed in results URL?

Can I modify or remove query string parameters displayed in results URL?

3 Replies
Gravatar for apare@coveo.com

Answer by Alexandre Paré, May 20, 2014 12:48 PM

you can add the option data-enable-history="false" to your Search interface to remove the hash parameters

<div id="search" data-enable-history="false" class="SearchInterface">

SearchInterface enableHistory

Gravatar for olamothe@coveo.com

Answer by olamothe, May 20, 2014 12:58 PM

I'm not exactly sure what you mean.

Do you mean the click uri of your results ? If yes, then you can listen to "preprocessResults"

$("#mySearch").on("preprocessResults", function(e, args){
  var results = args.results.results;
  for(var i = 0 ; i < results.length; i++){
     //Do your modification of the results object here...
     //For example :
     results[i].clickUri = results[i].clickUri.split("?")[0];
  }
})
Gravatar for jed_dube@cree.com

Answer by jdube, May 20, 2014 1:24 PM

Thanks very much for the responses. I was actually referring (imprecisely, sorry) to the url for the results page, which displays in the browser nav bar.

Gravatar for apare@coveo.com

Comment by Alexandre Paré, May 23, 2014 9:53 AM

did you still have a problem or data-enable-history="false" fix your problem?

Gravatar for jed_dube@cree.com

Comment by jdube, May 23, 2014 10:55 AM

Is there anywhere I can configure it using the Search Interface UI? (Note: I'm not a .NET developer; I thought this would be a forum for Admins since there is another forum for developers)

Or, do you know where exactly (in what control, in what sequence) I would place data-enable-history="false"?

Gravatar for apare@coveo.com

Comment by Alexandre Paré, May 23, 2014 11:38 AM

https://developers.coveo.com/display/JsSearch/SearchInterface+Component#SearchInterfaceComponent-enableHistory

on your SearchInterface component <div id="search" data-enable-history="false" class="SearchInterface">

Gravatar for jed_dube@cree.com

Comment by jdube, May 23, 2014 11:46 AM

Thanks again. I'm not using JavaScript or components. I'm just using the Search Interface GUI, some control .ascx files, and css. I will look through the control files to see where the setting might plug in.

Gravatar for apare@coveo.com

Comment by Alexandre Paré, May 23, 2014 1:32 PM

Search Interface GUI provide an option in the Advanced section called Enable history in the root search element.

Gravatar for jed_dube@cree.com

Comment by jdube, May 23, 2014 1:42 PM

On Advanced tab, I see this:

Edit Alternate URI

Description

URI Pattern Example: http://server/sites/sales/(.*)

Replacement Example: http://other_server/$1 Enabled by default Mandatory

Ask a question