Jump to:

2011 Posts in 1436 Topics by 620 members

Form Questions

SilverStripe Forums » Form Questions » Search routine includes html markup?

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

Page: 1
Go to End
Author Topic: 407 Views
  • cwchong
    Avatar
    Community Member
    13 Posts

    Search routine includes html markup? Link to this post

    The default search behaviour seems to perform a match of the search against say the "Content" field;
    but the content field would contain html markup as well.

    Thus this results in unexpected results when you search for terms such as "href" or "strong" where results are returned even when their meaningful content does not actually contain those terms.

    Is there a way to avoid this?

    I am thinking of creating a redundant "SearchContent" field in SiteTree and using onAfterWrite to duplicate the content into this field with tags stripped, and perform search on this field instead; is there another way? (Creating extra fields for each searchable dataobject will be a pita).

    Thanks!

    407 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.