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.

All other Modules /

Discuss all other Modules here.

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

Solr - Multi Valued Fields Indexing


Go to End


2 Posts   917 Views

Avatar
Beedubsss

Community Member, 7 Posts

4 September 2016 at 10:15pm

Edited: 05/09/2016 12:46am

Hey community,

I've working on a using the silverstripe-fulltextsearch module with the tagfield module. All pages on the site I'm working on can have tags assigned to them which is fine and all set up but I am not entirely sure how to tell silverstripe to index the property on the page as a multivalued field. I've looked through the silverstripe-fulltextsearch docs but haven't found anything that looks like it would be correct.

Cheers

Avatar
Willr

Forum Moderator, 5523 Posts

5 September 2016 at 5:41pm

Hi,

It's a bit of a trick to push tags into Solr and get them searchable. Here's a sample new index which is typical of pushing tags into Solr. In this example I push the ID of the tag (which doesn't change if the tag title does) then on the front end search normally I'd have a dropdown and filter by a given tag ID.. Something like

$query = new SearchQuery();

//..
$query->filter('SiteTree_TagID', $_GET['TagID']);
..

(https://gist.github.com/wilr/735cab62711edb29979d6adfad8b7018)