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.

some search results show excerpts, others don't

March 10, 2011 5:04pm

Subscribe [3]
  • #1 / Mar 10, 2011 5:04pm

    Elanzi

    17 posts

    I’m building my first EE site (v2.1) and am having trouble getting my search results to display correctly. Simple Search fetches the correct results, but on the results page some of the entries show content in the excerpt and others don’t. This site has hundreds of pages, most of which are identical except for the channel and entry, and I can’t figure out what is different between the ones that work and the ones that don’t. Here are things I’ve checked and eliminated from consideration:

    -status open/closed is not an issue, since all are open
    -future/expired dates are not an issue, since no date fields are in use
    -channel administration prefs are set to show the correct field for {excerpt}
    -if I display {customfieldname} instead of {excerpt}, the results show up correctly, but I can’t use this method because a) there’s a lot of content in the pages, so the results would be too bulky and b) I need to use {excerpt} to control other functionality, like context, length, highlighting terms, etc.

    Here’s a live example:

    1. Go to http://cco.vrafoundation.org/ and search on “art”
    2. This should return 147 results. Scroll down the first results page until you see a series of Examples 140-152 that include excerpts with highlighted search terms.
    3. Scroll down farther until you see Examples 153-159, which display only an ellipsis, no excerpt.
    4. If you scroll to the bottom of this page, or continue on to the other two pages of results, you’ll see about a hundred other examples of results with no excerpts.

    The content for all these Example pages was entered at the same time, using the same methods as far as I’m aware, so I can’t see why they aren’t behaving in exactly the same way.

    Note that I am using both Structure and Search v1.3 (key_search) module. I contacted support for the Search module and they think it’s an EE core config issue. I wouldn’t be surprised if they’re right, but I just can’t think of anywhere else to check. The answer is right on the tip of my brain but I can’t quite reach it, so any ideas or approaches would be greatly appreciated!

  • #2 / Mar 11, 2011 5:43am

    John Henry Donovan

    12339 posts

    Elanzi,

    Welcome tot he forums 😊

    Ok to begin with, that {excerpt} tag is set from within your channel preferences where you choose a field to be your excerpt. First thing I would do is check which field is being used and then open up entries for examples 153-159 and see what is inside that custom field

    Who is the author of that Search Module?

    Can you do a test with the native Search Module. Just set up a dummy template group. In the index add the simple search tags from the docs and in another template add the search results from the docs. That way we can eliminate any third party issues

  • #3 / Mar 11, 2011 10:26am

    Elanzi

    17 posts

    Hi John, and thanks for replying so quickly!

    I’ve triple-checked that {excerpt} is set to “field_bodytext” (this is the custom field I’m using for all main body content) on every channel in the admin prefs.

    I just created dummy search templates at http://cco.vrafoundation.org/index.php/search_test using code from the docs. The only modifications I’ve made are removing the channel= parameter and adding a search_in=“entries” parameter. The results are identical to what I get when using the third-party module, which I got here:

    http://www.planet-ee.com/search.html

    I was hoping I’d wake up this morning and the answer would have come to me in my sleep. . . but not this time. Oh well.

  • #4 / Mar 11, 2011 4:08pm

    Sue Crocker

    26054 posts

    future/expired dates are not an issue, since no date fields are in use

    You may not be setting any dates using custom fields, but if the entry date is in the future, that could be the problem.

    What field type are you using for your excerpt field?

  • #5 / Mar 11, 2011 4:39pm

    Elanzi

    17 posts

    Hi Sue, and thanks for taking a look. Here are answers to your questions:

    - The entry date for one of the fields that’s *not showing* is: 2011-03-01 04:07 PM
    - The entry date for one of the fields that *is showing* is: 2011-03-01 04:02 PM
    - The custom field I’m using for {excerpt} is field type: Textarea

  • #6 / Mar 12, 2011 3:51pm

    John Henry Donovan

    12339 posts

    Please check your email

  • #7 / Mar 14, 2011 3:00pm

    Sue Crocker

    26054 posts

    Hi, Elanzi - thanks for posting your login details. We’ll be getting back to you shortly. Most communication will be in this thread.

  • #8 / Mar 15, 2011 4:58pm

    Sue Crocker

    26054 posts

    Hi, Elanzi.

    Is there a reason you’re using a channel per entry?

  • #9 / Mar 15, 2011 5:27pm

    Elanzi

    17 posts

    In most cases, each entry is displayed on a separate page of the site, i.e. most of the channels you see are body content for individual pages. I may be misunderstanding an EE architecture concept, and if so please tell me—but I thought it was necessary to create a unique channel as a container for each page’s main body content, and that therefore each channel would need at least one entry. True?

  • #10 / Mar 16, 2011 12:08pm

    Sue Crocker

    26054 posts

    Not true.

    There are several ways you can handle this. I tend to do the following:

    1. Create a channel with the fields you need.

    2. Create an index template that displays x number of entries for that particular channel.

    3. Create a single entry template that you feed in the url_title of the entry you created.

    So going from the assumption you have a channel called test, and a template group called test with the single entry template being test/info, and an entry with the url_title of test_1234, you’d have a url like this:

    http://example.com/index.php/test/info/test_1234

    Now if you wanted to have a different url for some reason, you’d use Structure to change over to what you wanted.

    NOTE: If you don’t use Structure, you’d use the Pages module.

    This doesn’t solve the problem you’re having with the search results, but with so many channels it’s harder to troubleshoot.

    Are you up to changing the channels over to a single channel?

  • #11 / Mar 16, 2011 2:15pm

    Elanzi

    17 posts

    Okay, I think I get the concept: all content pages boil down to one channel, one template, many entries, and the entries are then called via the entry’s URL in the format index.php/template_group/template/entry_ID. Is that right? And this will continue to work with Structure so the client can easily add/edit/move pages?

    I’m willing to do this, since it makes much more sense structurally and will ease maintenance over the long term. It will take a lot of time, especially since I have multiple projects in progress right now. If you confirm the above, I’ll make these changes asap and get back to you when it’s done. . .

  • #12 / Mar 16, 2011 4:25pm

    Elanzi

    17 posts

    Update: no need to reply to the above. I’ve done some tests, have the concept working, and have already started reassigning pages. . . thanks for the tip, it’s much better this way!

  • #13 / Mar 16, 2011 6:51pm

    Elanzi

    17 posts

    Another (final?) update: creating a new template and channel, and assigning all the examples to it, has solved the search problem. I still have no idea what the problem was, but I since it no longer exists, I don’t really need to know. Will let you know if the problem recurs somewhere else, but for now it looks like I’m good. Thanks for the suggestion!

  • #14 / Mar 17, 2011 12:10pm

    Brandon Jones

    5500 posts

    Awesome, Elanzi. Sounds like you’re starting to get the hang of it. Welcome to ExpressionEngine!  :coolsmile:

    I’ll go ahead and close this out but don’t hesitate to post again.

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

ExpressionEngine News!

#eecms, #events, #releases