SimpleSearch finds only full words


(Michael Sauer) #1

Hey there,

we’re using SimpleSearch in our Neos Website and it works fine. Except that it finds only full words. For example: on the landing page there’s a text that contains “Markenkommunikation”. When I’m searching for “kommunikation” or “marken” this entry won’t be listed in the results. When I’m searching for “markenkommunikation” it will be found. I can’t find a setting for this “problem”. Maybe someone can help me?

Neos 3.2.1
SimpleSearch 2.0.0

Kind regards,
Michael


(Michael Sauer) #2

The problem still exists, even after updating Neos and SimpleSearch.

Neos 4.1.8
SimpleSearch 3.0.1
SimpleSearch-ContentRepositoryAdaptor 2.0.3

This is our fusion configuration for the search:

prototype(Flowpack.SimpleSearch.ContentRepositoryAdaptor:Search) {
    templatePath = 'resource://Laudert.Website/Private/Templates/NodeTypes/Search/SimpleSearch.html'

    searchResults = ${Search.query(site).nodeType('Neos.Neos:Content').log().fulltext(request.arguments.search.word).execute()}
    searchWord = ${request.arguments.search.word}

    searchResultContent = ${Search.query(searchResult).nodeType('Neos.Neos:Content').fulltextMatchResult(request.arguments.search.word)}

    @cache {
        mode = 'uncached'

        context {
            1 = 'site'
            2 = 'node'
        }
    }
}

I can’t find any documentation for this package and would be thankful if someone could help me with this problem. :slight_smile:

Regards,
Michael


(Christian Müller) #3

Did you try something like searchword* ? Like Marken* for exmple to find that word on your page.


(Michael Sauer) #4

Yes I did and that works but our marketing department wants the “normal” behavior (without asterisk).


(Sebastian Helzle) #5

Then you could just add the asterisk after submit.


(Christian Müller) #6

That. It’s up to you to construct the respective query you need. SimpleSearch just provides the tools. It works with appropriate wildcards. What you seem to want is automatic stemming but that is not available with simple search but only elastic search. As suggested check if the search request contains a * already and if not add it to get the result you want.


(Michael Sauer) #7

How do I realise this with fusion? I managed to check if an asterisk exists at the end of the search word, with:

foo = ${String.endsWith(this.searchWord, '*')}

But how do I create a condition and add an asterisk if it’s missing? I’m failing on this one. I don’t know why but Fusion is too complicated for me, I don’t get it. :see_no_evil:


(Michael Sauer) #8

I still don’t get it and I think fusion is not the solution because if I’m able to adjust the search word it would be displayed in the frontend with the asterisk. But the asterisk should be used only for the search itself and not be displayed in the frontend.

How do I extend classes in Neos / Flow? I would like to extend the SqLiteQueryBuilder class of Flowpack\SimpleSearch\Search and adjust the


(Christian Müller) #9

Why would it, you just adjust what you put into your search query. Doesn’t necessarily effect what it shown to people.

foo = ${String.endsWith(this.searchWord, '*') ? this.searchWord : this.searchWord + '*'}

should do the trick.