Query: Search for words that includes string x

Enonic version: 6.10.3
OS: Win 10

Hello.

I’m working on a search feature, and want my results to include any matching, or partly matching words.

Currently the query looks like this:
fulltext(‘data.body,_alltext’, ‘word’, ‘AND’)
OR ngram(‘data.body, _alltext’, ‘word’, ‘AND’)
AND _path LIKE ‘/content/MySite/*’

This query works great for any directly matching words (fulltext) and for any words beginning with the searched word(ngram). But it will not give a match if the word is a substring of another.

For instance:
I want so search for ‘gandalf’
‘gandalf’ returns all articles with the word. fulltext
‘gan’ returns all places words start with gan. ngram
‘andalf’ returns nothing.

I’ve noticed this is the same for the search feature in Content Studio, except for images (?), does this mean that this kind of text query is currently not supported?

Thanks!

Try using fuzzy for your fulltext search. Last resort is using LIKE which is very slow in comparison

1 Like