5093 Posts in 1516 Topics by 1113 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 1763 Views |
-
Search custom fields

21 October 2010 at 10:30am Last edited: 21 October 2010 10:33am
What I like most about SilverStripe is that it's easy to create templates with more than one content field, and for the site owner to edit that content.
If your page has custom fields on it the search currently cannot handle searching these. It will only search the default title, content fields
http://www.silverstripe.org/archive/show/196669#post196669How can the site search find the content of custom fields? This is surely something most SilverStripe developers need to implement at some point?
things like the forum have got there own custom search forms with their own querying engines.
http://www.silverstripe.org/form-questions/show/256689I looked at the forum search, then had to lie down. It'll take days to unravel that lot. I'd be most grateful if someone could post an example, or link to a recipe.
Thanks,
Jules -
Re: Search custom fields

21 October 2010 at 8:06pm
If you can set up sphinx search. It's designed to be extended much more and has a bunch of nice features (like searching custom fields and file content)
-
Re: Search custom fields

24 October 2010 at 12:43pm
I used a *hack* on a site recently that amalgamated the contents of my custom fields and stuck them in the MetaDescription field onBeforeWrite, which is searched by the default search.
I then created a custom db field to hold the actual meta description and replaced the field under the metadata tab with my own, as well a overriding the MetaTags fucntion to use my replacment field in it's return value.
I know this is a bit of a dirty hack, but if it's quick implentation you are after then it works well with very little overhead.
Aram
---------------------------------------------------------------------------------
www.ssbits.com - Your one stop SilverStripe learning resource
-
Re: Search custom fields

26 October 2010 at 12:05am
I've got a basic recipe that I've posted in this thread, hope it helps...
http://www.silverstripe.org/customising-the-cms/show/288544#post288544
-
Re: Search custom fields

27 October 2010 at 1:10am
Thanks guys. That gives me 3 options
1 - Sphinx
2 - Concatonate searchable fields into MetaDescription
3 - Custom searchI'd call 2 a 'quick fix' rather than a 'dirty hack'. It's probably more efficient than 3 because only one field is searched. You'd probably want to use an XML parser to strip the HTML tags out of the searchable content though.
If I was going to do one SilverStripe site then move on, I'd use 2. If I used shared hosting so couldn't install Sphinx then I'd use 3. But Sphinx has to be the way to go.
-
Re: Search custom fields

27 October 2010 at 2:00am
I have been wanting to get round to sphinx module for some time, please let us know how you get on. I'd like to upgrade all my search so that it includes search pdfs and dynamically created pages... so as I say I'd be very interested in your results...
-
Re: Search custom fields

27 October 2010 at 10:45am Last edited: 27 October 2010 10:48am
> please let us know how you get on
Sure, will do, when I get around to setting it up
The other bespoke CMS I work with uses Xapian, which is very fast + flexible + scalable and doesn't require a separate daemon. So it'll be interesting to see how Sphinx compares.
| 1763 Views | ||
|
Page:
1
|
Go to Top |



