Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » How to retrieve related articles (Fulltext-search)

Our old forums are still available as a read-only archive.

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

Page: 1
Go to End
Author Topic: 2241 Views
  • Fuzz10
    Avatar
    Community Member
    787 Posts

    How to retrieve related articles (Fulltext-search) Link to this post

    Hi all,

    I'm currently trying to figure out a way to get related articles (related to the current article that is) from the database. Normally I would run a match-search on titles, descriptions and keywords (with the current title, description and keywords) and if that didn't produce any hits I'd run a mysql fulltext-search.

    Can't seem to figure out how to go about implementing this in SS.

    Would someone be so kind to point me in the right direction ? ;-)

  • Fuzz10
    Avatar
    Community Member
    787 Posts

    Re: How to retrieve related articles (Fulltext-search) Link to this post

    Kinda' Solved it.

    There probably is a better way of doing it (by using the built in search engine for example) but I can't find any docs on it.

    I didn't realize I could use Mysql's MATCH .. AGAINST in combination with data-objects.

    So I ended up with :

    DataObject::get("Page", "MATCH (Title, MenuTitle, Content, MetaTitle, MetaDescription, MetaKeywords) AGAINST ('$this->MetaKeywords')");

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