Jump to:

22977 Posts in 11742 Topics by 2826 members

General Questions

SilverStripe Forums » General Questions » Silver stripe search

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

Page: 1 2
Go to End
Author Topic: 5526 Views
  • AndrewMK
    Avatar
    Community Member
    23 Posts

    Silver stripe search Link to this post

    Hi, We are experimenting with the built in search functionality and seem to have come across some limitations that potentially could be show stoppers in regards to using Silverstripe for this purpose.

    Basically we are intending to use silverstripe as a knowledge base of sorts and the search function as thew main tool as finding information relating to what you are looking for.

    Unfortunately much of the information searched for are commonly known by their Acronyms e.g LIM,PIM,COA etc and the built in search as it stands does not seem capabel of searching for these phrases.

    Does anyone know a way around this?

  • tobych
    Avatar
    Community Member
    97 Posts

    Re: Silver stripe search Link to this post

    Hi. I'm working on a mini-knowledge base in SilverStripe myself, so thought I'd reply to you. First question is... what exactly is it that you think SilverStripe can't do? Obviously it can search for those phrases, but presumably you mean you'd want the results of searches for those phrases to include results where the article included the expanded phrase. Am I right?

    If so, a couple of options spring to mind. One would be to have a separate keywords field for each article in your knowledge base, which is included in searches. Another would be to have a database of acronyms and their expansions that you could use either to expand acronyms just before you do the search, or contract (acronymise?) when you're adding articles. The database could be just a text file or hardcoded in PHP, or better still, included in the MySQL database, and managed using the new ModelAdmin model.

    That all might be way more complicated than you're envisaging. Of course, even Google doesn't do clever expansions like that... Wikipedia does in a way though, by having pages that redirect from acronyms to their expansions, and probably vica-versa.

    For what it's worth, I spent a couple of hours looking at the Interspire Knowledge Manager documentation last night, and though ooh, you could do a lot of that in SilverStripe.

    Hope this waffle helps!
    Toby

  • AndrewMK
    Avatar
    Community Member
    23 Posts

    Re: Silver stripe search Link to this post

    Hi Toby,

    I actually meant that using the site search from the tutorials if i know the acronym appears in the title and/or the content it will not return it.

    E.g have a page with the phrase 'PIM' in the title and search for the phrase 'PIM' and i get no results.

  • tobych
    Avatar
    Community Member
    97 Posts

    Re: Silver stripe search Link to this post

    Oh, I see. Well that got quite exciting for a while there, didn't it. Um, so basically you've implemented the search in a tutorial (which one?), and it doesn't work? Well, I can't see anything special about these phrases... unless they're in a different case in the articles than the one you're searching for. Maybe show us the code you're using to do the search.

  • AndrewMK
    Avatar
    Community Member
    23 Posts

    Re: Silver stripe search Link to this post

    Heres the code im using:

    function SearchForm() {
    $searchText = isset($this->Query) ? $this->Query : 'Search';
          
    $fields = new FieldSet(
    new TextField("Search", "", $searchText)
    );

    $actions = new FieldSet(
    new FormAction('results', 'Go')
    );

    return new SearchForm($this, "SearchForm", $fields, $actions);
    }
    function results($data, $form){
    $data = array(
    'Results' => $form->getResults(),
    'Query' => $form->getSearchQuery(),
    'Title' => 'Search Results'
    );
       
    return $this->customise($data)->renderWith(array('Page_results', 'Page'));
    }

    As you can see its pretty much straight out of the tutorials on the wiki.

    on another note if i create a custom SearchContext and specifically search the field that contains the acronym iit will return the correct result but the probelm is that i end up with different search boxes for each searchable field rather than just a general search box.

  • Fuzz10
    Avatar
    Community Member
    786 Posts

    Re: Silver stripe search Link to this post

    Yeah , the site functionality could use some lovin' ;-)

    I noticed this too ..... (it doesn't search for less than 4 chars)

    See :

    http://www.silverstripe.org/archive/show/4989?showPost=169647

  • weberho
    Avatar
    Community Member
    15 Posts

    Re: Silver stripe search Link to this post

    The standard search functions are using the MySQL fulltext-search functins. Per default words shorter than four characters are not indexed (see documentation http://dev.mysql.com/doc/refman/5.1/en/fulltext-search.html )

    To index shorter words, this should do the trick:

    1) change my.cnf:

    ft_min_word_len = 3

    2) rebuild the indices:

    REPAIR TABLE sitetree QUICK;

  • AndrewMK
    Avatar
    Community Member
    23 Posts

    Re: Silver stripe search Link to this post

    So I tried as WeberHo described in the above post and although i can see that i have changed the ft_min_word_len to 3 i still cannot search for 3 letter words?

    5526 Views
Page: 1 2
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.