ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Search like EE?

June 19, 2011 1:30am

Subscribe [4]
  • #1 / Jun 19, 2011 1:30am

    chrisstroud

    17 posts

    Hi,

    Is there any documentation on how to implement the search like they have on the EE site?

    For instance, it searches the user guide, forum, and wiki.

    I would like mine to search my wiki and forum.

  • #2 / Jun 19, 2011 2:48am

    terjin

    8 posts

    This has always been really helpful. http://ellislab.com/expressionengine/user-guide/modules/search/index.html

    Otherwise if you need more powerful search capabilities, consider Solspace’s Search module. http://www.solspace.com/software/detail/super_search/

  • #3 / Jun 19, 2011 2:08pm

    chrisstroud

    17 posts

    Thanks. Have the search form set up and the search is working. How do we get it so that it searches say Forum and Wiki like they have on this site?

  • #4 / Sep 12, 2011 10:20am

    glenndavisgroup

    436 posts

    I’m also looking into how this is done. Can anyone from EE respond to this please?

    Thank you,

    Mike

  • #5 / Sep 12, 2011 1:07pm

    Mark Bowen

    12637 posts

    Hi Mike,

    As this was posted to the Community Help forums we don’t provide support in here although we do stop by from time to time, much like I’m doing now 😉

    I have to admit that I don’t know exactly how the search is implemented, however, looking at what it is doing it appears as though on the forum search results page those three links for the User Guide, Forum Archives and Wiki are just POSTing the keywords used in the search field to those respective places as though you had just physically gone to the search fields on each of those pages and typed them in for yourself.

    Does that help at all?

    Mark

  • #6 / Sep 12, 2011 1:45pm

    glenndavisgroup

    436 posts

    Hi Mark,

    Thanks very much for the quick reply. I see what you mean. So each link is basically running the search in that section (Wiki, Forum etc.) when you click the link. Thanks for pointing that out. In my case I need to display the results from all sections and indicate which section it’s from (Wiki, Forum, News etc.). But I think I might know how to do this now that you clarified that for me 😊.

    Thank you,

    Mike

  • #7 / Sep 13, 2011 11:27am

    glenndavisgroup

    436 posts

    Actually I take that back. I just looked at the page source and EE is using the following JavaScript code to do their Wiki and Forum search:

    function search_wiki()
    {
    var wikiform = document.createElement('form');
    var inputkeywords = document.createElement('input');
    var inputXID = document.createElement('input');
    wikiform.setAttribute('action', 'http://expressionengine.com/wiki/Special:Search_results/');
    wikiform.setAttribute('method', 'post');
    wikiform.setAttribute('style', 'display: none;');
    inputkeywords.setAttribute('type', 'text');
    inputkeywords.setAttribute('name', 'keywords');
    inputkeywords.setAttribute('value', 'search all modules');
    inputXID.setAttribute('type', 'text');
    inputXID.setAttribute('name', 'XID');
    inputXID.setAttribute('value', '55a67600b4a0f45dd263431c6a0c0d1bfc9bf49b');
    wikiform.appendChild(inputkeywords);
    wikiform.appendChild(inputXID);
    document.body.appendChild(wikiform);
    wikiform.submit();
    }
    
    function search_archives()
    {
    var archiveform = document.createElement('form');
    var inputkeywords = document.createElement('input');
    var inputXID = document.createElement('input');
    var inputboardid = document.createElement('input');
    var inputsiteid = document.createElement('input');
    archiveform.setAttribute('action', 'http://ellislab.com/forums/do_search/');
    archiveform.setAttribute('method', 'post');
    archiveform.setAttribute('style', 'display: none;');
    inputkeywords.setAttribute('type', 'text');
    inputkeywords.setAttribute('name', 'keywords');
    inputkeywords.setAttribute('value', 'search all modules');
    inputXID.setAttribute('type', 'text');
    inputXID.setAttribute('name', 'XID');
    inputXID.setAttribute('value', '121651de5880b9a63e7396b9aa48d5c322411e90');
    inputboardid.setAttribute('type', 'text');
    inputboardid.setAttribute('name', 'board_id');
    inputboardid.setAttribute('value', '1');
    inputsiteid.setAttribute('type', 'text');
    inputsiteid.setAttribute('name', 'site_id');
    inputsiteid.setAttribute('value', '2');
    archiveform.appendChild(inputkeywords);
    archiveform.appendChild(inputXID);
    archiveform.appendChild(inputboardid);
    archiveform.appendChild(inputsiteid);
    document.body.appendChild(archiveform);
    archiveform.submit();        
    }

    I need more info to get this to work this way. Any idea how I can generate the XID value without using

    {exp:search}{/exp:search}

    ?

    Thank you,

    Mike

  • #8 / Sep 13, 2011 1:50pm

    glenndavisgroup

    436 posts

    Ok I figured out the XID var. I have to use:

    {XID_HASH}

    To get a unique XID. Now I will try and make my search work similar to EE.

    Mike

  • #9 / Sep 13, 2011 3:31pm

    Mark Bowen

    12637 posts

    Hi Mike,

    Yep the {XID_HASh} has always been a little bit of a hidden feature. Glad you found that.

    Hope it goes well for you with your coding.

    Best wishes,

    Mark

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases