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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Data Model Questions /

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

Site search using page tags


Go to End


1036 Views

Avatar
NETim

Community Member, 24 Posts

2 February 2012 at 10:50pm

Hi,

I have been trying to put together a search system that will search for pages that have been given certain tags.

The basic principle is that I have a type of page that can have any number of tags applied to it. The tags are controlled through modelAdmin so we build up a list of tags that could be applied to any of the tagable page types. What I am trying to achieve is the ability to search for pages which match all of the selected tags.

For example:

We have multiple pages for cars which have tags based on the car they are describing:

car page 1 tags: Red, 4 wheels, Soft top

car page 2 tags: Blue, 4 wheels, soft top, fast

car page 3 tags: Blue, 4 wheels, slow

on our search page we would have a list of all of the unique tags as checkcboxes so that the user could find a car that matches their needs:

tags:
Red,
Blue,
4 wheels,
soft top,
fast,
slow

My intention is that if a user searched for the tags Blue and 4 wheels, they would see cars 2 and 3. If they then added 'fast' they should only see car 2.

Any ideas?

Thanks,

T.