Search Module - subset of pages

edited October 2014 in Modules
Hi

My search module is working fine however I'd like to refine the search results such that the user can select a category and a search term and return just the results for that category.

When I say "category", what I actually mean is module - I have a simple module called "computers", I'd like the search to just look at the pages generated by that module. I have the preview_path set and the module's pages appear in a normal search...

Is this possible?

Cheers

Comments

  • edited 8:23AM
    I'm assuming you are referring to this module correct?
    https://github.com/daylightstudio/FUEL-CMS-Search

    There is an "exclude" parameter you can set as either an array of pages or a regular expression string (it also honors the robots.txt file). Alternatively, you can set the sitemap.xml file and change the $config['index_method'] = 'sitemap';

    Additionally, there is a $config['index_modules'] value you can set which can be TRUE, FALSE, or an array of modules to index.
  • Yes - the FUEL-CMS-Search module.

    It would seem these options would restrict my whole index. It's not quite what I'm after. I'd still want a standard (search everything) option but also, say, a dropdown box on the search page to allow the user to refine the search to a specific module.

    I have a "computers" module and a "phone" module. With "computers/detail/{slug}" and "phones/detail/{slug}", I can present detail on such items. My index includes all my static pages, all computers/detail and all phones/detail pages.

    I'd like to offer the option to search all pages, just computers or just phones.

    Having reviewed the search module code, it looks like I'll need to add a function to the model that will restrict results by the [fuel_search][location] field...

    Has anyone done this?
  • edited 8:23AM
    Since the model uses Active Record, you can do further where restrictions on a query like so:
    $CI =& get_instance(); $CI->load->module_model(FUEL_FOLDER, 'search_model'); $CI->search_model->db()->where(array('location' => $my_location)); $CI->search_model->find_by_keyword($my_keyword);
Sign In or Register to comment.