Matrix Search Page partial matching?


(Aleks Bochniak) #1

Hello,

 

I have an issue with a search page asset that I need assistance with.

 

I have a News item that is has a metadata field subject with 'Computer Science' value, however if I query for subject = Science this news item appears in results.

 

How do I restrict this search field from matching 'Computer Science' with 'Science' ? Is this even possible with Search Page assets?


(Bart Banda) #2

On the search field screen of the search page, you need to specify that the search field needs to match all words and not just any. It's the word logic selection option, set it to All Words. More info here: http://manuals.matrix.squizsuite.net/search/chapters/search-page#Search-Fields-Screen


(Aleks Bochniak) #3

What if news items 'subject' metadata is a multi-text field with multiple entries. eg. Computer Science; ICT; Information Technology;  ?

 

All words logic may not work in this instance.


(Bart Banda) #4

Sorry, I confused the problem and the solution a bit. Setting it to All words just means it will match on all all words typed in the query, so if you put "Science blah" it won't get any results, you probably want it back to Any words, my mistake.

 

For your issue, I don't think it can be done in a simple matrix search setup, something Funnelback is good for though. The conditions you want it to work under are also very hard to meet, as matrix will just look at the text value stored against the metadata, so it has no idea you don't want "Computer Science" to match on "Science", but to match on just "Science" by itself. 

 

One trick you could do is to have another metadata field that has the default value of your subject metadata field, but actually replaces the spaces in any words with underscores, that will make the value stored in the field actually "Computer_Science; ICT; Information_Technology;". Your search shouldn't pick up "Computer_Science" on the 'Science" search term. You would just have to replace spaces with underscores in your search term as well, so if someone actually types "Information Technology", it gets searched as "Information_Technology". Not sure if that causes other problems, but not sure how else you would want to do it. 


(Aleks Bochniak) #5

Bart,

 

I am trying to avoid using funnelback for this one as it's a bit of an overkill. I was considering a workaround like the one you have suggested.

 

Cheers