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 and categories

June 02, 2010 10:10pm

Subscribe [2]
  • #1 / Jun 02, 2010 10:10pm

    qaswa

    9 posts

    I know the prior version did not support categories in the search content targets, but I’m curious if 2.0 does. I may be reading the docs incorrectly, but it does the advanced search form category parameter allow for this? Adding a couple category ID’s did not seem to work, but I may be doing something wrong. Searching is working within channel data btw.

    If this is not currently possible, does anyone have any solution for making this work? If not, would using one of the 3rd party tagging solutions (such as Taggable) solve my problem?

    Seems to me using categories to feed search results makes a lot of sense. Am I missing something? Is there a better way to do this?

    thanks in advance,
    Ammon

  • #2 / Jun 03, 2010 5:59am

    Ingmar

    29245 posts

    I know the prior version did not support categories in the search content targets

    I don’t fully understand that sentence. Do you mean you want to search and limit by category? The advanced search form should allow you to select a category or categories, yes.

  • #3 / Jun 03, 2010 2:41pm

    qaswa

    9 posts

    No, I’d like the search results to return entries who’s category name matches the search query.

  • #4 / Jun 03, 2010 3:32pm

    Ingmar

    29245 posts

    I am afraid that’s not out-of-the-box functionality. Your best option would probably be a custom query here.

  • #5 / Jun 03, 2010 4:38pm

    qaswa

    9 posts

    Thanks for the response. Is there any more information anyone can give me to initiate this custom query? Would I need to modify the search php function itself? Or is there a simpler path?

  • #6 / Jun 03, 2010 4:50pm

    Ingmar

    29245 posts

    You wouldn’t have so much modify the search as basically run it yourself, taking the search term the user submits and query the database (including categories) for them. Let me know if you want to discuss this further and I can move this thread to Howto for you.

  • #7 / Jun 03, 2010 5:10pm

    qaswa

    9 posts

    Yes, please move the thread.

    Just to clarify, the ideal scenario is:
    1. user searches using a simple/single field
    2. all entry fields (that have search enabled) AND all category names would be used
    3. a single page of results

    I understand how to query the DB directly to filter entries, but I do not understand how to combine these two (apparently) different modes of search.

    thank you for your time!

  • #8 / Jun 03, 2010 5:38pm

    Ingmar

    29245 posts

    Moved as per request.

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

ExpressionEngine News!

#eecms, #events, #releases