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.

Simple search not searching Pages content

November 18, 2014 1:31pm

Subscribe [3]
  • #1 / Nov 18, 2014 1:31pm

    I’m using the simple search from the Search module and I’ve noticed that it doesn’t seem to be searching any content from Pages. I’ve specified the channel for the Page content in the search tag, the content exists, and the field is searchable. Is there something I’m missing?

  • #2 / Nov 19, 2014 12:58pm

    Boyink!

    5011 posts

    Did you specify “everywhere” as a parameter on your search tag? By default it’s titles only.

  • #3 / Nov 19, 2014 1:42pm

    Yep, specified “everywhere” in the tag, and I can confirm that it works for non-Page entries. In fact, if the search term occurs on regular entries as well as Pages it’ll return the regular entries. And the total number of results only counts the regular entry results even if a Page would match, so it doesn’t seem to be a matter of the results just not displaying correctly.

  • #4 / Nov 19, 2014 2:14pm

    USC Chan

    81 posts

    Can you post the code you’re using to call the search, and the code you use to display the search results?

  • #5 / Nov 19, 2014 2:19pm

    Here’s the code for the “search” snippet I use:

    {exp:search:simple_form result_page="site/results" no_result_page="site/no_results" channel="site|blog|collections|studies|funding|resources|topics" }
        <div class="input-group">
            <input type="text" class="form-control" alt="Site Search" placeholder="Search" name="keywords" id="keywords" search_in="everywhere">
                <div class="input-group-btn">
                    <button class="btn btn-default" type="submit"><span class="glyphicon glyphicon-search"></span></button>
                </div>
        </div>
    {/exp:search:simple_form}

    “site” is a utility channel that holds various general pages (404, etc.).

    Here’s the code for the results:

    {exp:search:search_results}
     {exp:stash:append_list name="results"}
      {stash:title}{title}{/stash:title}
      {stash:excerpt}{excerpt}{/stash:excerpt}
      {stash:channel}{channel}{/stash:channel}
      {stash:path}{auto_path}{/stash:path}
     {/exp:stash:append_list}
    {/exp:search:search_results}


    Thanks for taking a look at this, folks, I definitely appreciate it.

  • #6 / Nov 19, 2014 2:35pm

    USC Chan

    81 posts

    You’ve got the search_in parameter in the <input> tag, rather than the simple_form tag. Move it to the simple_form tag and see if that makes a difference.

    Also, note that if you’re returning content from the Pages module, you might want to be displaying {page_url} rather than {auto_path}.

    NB: I submitted a bug report about the handling of page_url/auto_path in simple search results about a month ago. It might not be related to your problem, and it hasn’t been accepted yet, but it might be worth a look:

    https://support.ellislab.com/bugs/detail/20653/incorrect-handling-of-page_url-auto_path-in-simple-search-results

  • #7 / Nov 19, 2014 3:57pm

    Boyink!

    5011 posts

    I’d also try it with all the Stash stuff removed. I’m not sure what the benefit is there?

  • #8 / Nov 20, 2014 9:10am

    Success! I moved the “search_in” parameter and that fixed it. Thanks!

  • #9 / Nov 20, 2014 9:19am

    I’d also try it with all the Stash stuff removed. I’m not sure what the benefit is there?

    On the results page I’m displaying the results by channel with separate formatting, and I’m basically looping through a list of the channel titles, matching the channel title against the results, and displaying that batch of results in its own section. I figured using Stash cuts down on the number of database queries.

    Thanks for taking the time to look at this!

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

ExpressionEngine News!

#eecms, #events, #releases