Jump to:

3460 Posts in 1064 Topics by 739 members

Data Model Questions

SilverStripe Forums » Data Model Questions » Quick search with extra fields (per page-type)? Is it possible?

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 410 Views
  • Friksel
    Avatar
    Community Member
    7 Posts

    Quick search with extra fields (per page-type)? Is it possible? Link to this post

    In the CMS we use different DataObject-Types and custom PageTypes, all with there own relations and datafields.
    Now I want to use the quick site-search option of Silverstripe 3.0.3. That works exactly like I expect, but it only searches in the fields Title, MetaTitle, MetaDescription and Content.

    I want to expand this functionality so that it also searches through other fields and dataobjects used as relations in those pages. I was hoping that it just as easy as filling in the static $searchable_fields array with the extra fields to search in, but that doesn't work.

    Here is how I enter the searchfield 'Introduction' (Text) as a searchable field:

    static $searchable_fields = array(
    'Introduction'
    );

    Am I doing something wrong here? I don't understand the meaning of $searchable_fields if it doesn't search those fields.

    So how can I create a general quick search that works on every page and returns the result of all pages, searched not only in the default fields, but also in (for each pagetype different) extra fields? I tried a lot and was reading my way through some Silverstripe docs about searching, but somehow it either doesn't work for my needs or I don't get the systematics of it.

    Hope you guys can help!!

    410 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.