Search Filters - how to set search mode and get exact phrase? & how to get results with quotes in va

Marcel Guldemond asked on July 5, 2016 21:12

I have two dropdown filters that aren't fully working.

The first issue is the filter has two options where option A is contained in option B, so the results when A is selected also include the results for option B: A = "Broadloom", B = "Performance Broadloom"

If there is a way to set Search Mode to Exact Phrase, this might work. The issue is complicated by the search form also having a user input dialog, so if the search is coming from here, then it would be better to have it be all words. Is there anyway to force a different search mode depending on whether the user has made a selection from a dropdown vs. added text to the dialog?

The second issue is that a search filter with values containing quotes simply doesn't work. Do we have to set escape characters on the filter values? The values are coming directly via query from the same field we're trying to match against, so it should match. As well, if I write a basic sql query and add the value to it in sql manager, it returns the matches.

eg. of a filter value: <option value="ProductSize:(24" x 24")">24" x 24"</option>

Recent Answers

Trevor Fayas answered on July 5, 2016 21:25 (last edited on March 24, 2018 12:15)

First issue, you can try to use a Macro in the Search Mode that looks to the URL parameter, something like

{? if(!string.IsNullOrWhiteSpace(searchtext)) { return "The mode"; } else { return "ExactPhrase"; } |(user)zbynekh|(hash)a5f65380e853301cf8e7e59f9e98a1575472d857090199b1b707e4082997de34?}

Sorry i forgot what the mode is for the non exact phrase (you may have to inspect the normal drop down so you can find the value).

For the second issue, again you may need to use Macros to clean up the value that comes in, for you need to use the escape character \ before any of the following reserved characters: && || ! ( ) { } [ ] ^ " ~ * ? : \

So use a macro such as {% MySearchValue.Replace("\"", "\\"") |(user)zbynekh|(hash)a47c0c1f9e93d0d4a242d7e8f82103847b0c7c7592417858a7ebf392f619613d%}

0 votesVote for this answer Mark as a Correct answer

Marcel Guldemond answered on July 6, 2016 14:49

Thanks Trevor, I'll give those a try.

0 votesVote for this answer Mark as a Correct answer

Marcel Guldemond answered on July 27, 2016 16:06 (last edited on July 27, 2016 16:07)

ok, for the second problem, I've tried the following checkbox values and none have worked:

  • value="ProductSize:(9\" x 36\")"
  • value="ProductSize:(9\\" x 36\\")"
  • value="ProductSize:(9\\\" x 36\\\")"

any more suggestions on how to escape this would be helpful, thanks.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.