Forum Discussion

miikka's avatar
miikka
Maven
9 years ago

Setting search scope through parameters

Hi,

is it possible to give search scope as a parameter for the search form? As I want to limit the search to Idea Exchange without having the search granularity options shown. Right now I have:

<component id="common.widget.search-form" defaultToCommunity="false" hideGranularity="true"/>

So in theory the search form should pick up the search scope automatically but it's still searching across the community.

 

We could not use 'Search And Post Page' directly due to design reasons and needed to create a custom version of that. So could it be that when using a custom page included in the Idea Exchange Page the scope does not get picked up?

 

Cheers,

.M

4 Replies

  • DougS's avatar
    DougS
    Khoros Oracle
    9 years ago

    There is no parameter for the search component that lets you scope the search to a node or conversation style.

     

    You could probably use javascript to add a hidden field to the form for the "location" parameter, set to "board%3A" + boardName

     

    Obviously that is a bit hacky and not ideal, but I don't think the "location" parameter will change unless we add another version of the search form (in which case you would be able to self-upgrade and fix it).

     

    -Doug

  • miikka's avatar
    miikka
    Maven
    9 years ago

    Thanks DougS,

    for the clarification and the suggestion. This sounds a bit hacky but definitely is one option. The other option I was thinking about was to have the search granularity element in the search form (it defaults correctly to the ideation board) and then just hide it using CSS.

     

    So I'll test which approach works better and is less hacky.

     

    And if there's no official development idea posted for this kind of parameter, I can post that too for tracking purposes.

     

    Cheers,

    .M

  • DougS and/or tealiumjustin - I know this thread is a tad older, but I was wondering, is there also a solution that would impact the results that show in the suggestion box (the thing that shows up after you start typing your search)? When I tried adding some JS to force a location, I didn't see suggestions show up, rather it only worked upon submission. Wondering if there is a potential solution anyone can think of that would help with that.

    Basically, I have an empty category node that I want to search some specific boards that are found elsewhere on the community.