Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

General Questions /

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

Silver stripe search


Go to End
Reply


15 Posts   5777 Views

Avatar
AndrewMK

Community Member, 23 Posts

16 February 2009 at 11:20am

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?

Avatar
tobych

Community Member, 97 Posts

19 February 2009 at 2:32pm

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

Avatar
AndrewMK

Community Member, 23 Posts

19 February 2009 at 2:36pm

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.

Avatar
tobych

Community Member, 97 Posts

19 February 2009 at 2:43pm

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.

Avatar
AndrewMK

Community Member, 23 Posts

19 February 2009 at 3:27pm

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.

Avatar
Fuzz10

Community Member, 787 Posts

19 February 2009 at 9:40pm

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

Avatar
weberho

Community Member, 15 Posts

19 February 2009 at 10:02pm

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;

Avatar
AndrewMK

Community Member, 23 Posts

23 February 2009 at 10:42am

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?

Go to Top