Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SearchBundle] Misleading documentation #3364

Open
tentwofour opened this issue Mar 26, 2024 · 0 comments
Open

[SearchBundle] Misleading documentation #3364

tentwofour opened this issue Mar 26, 2024 · 0 comments

Comments

@tentwofour
Copy link
Contributor

Within the SearchBundles' services.yml, it's stated to override the kunstmaan_search.search.factory.analysis.class parameter, to change from the default LanguageAnalysisFactory to the NGramAnalysisFactory, but the service definition uses a hardcoded class, instead of a parameter:

parameters:
kunstmaan_search.search_provider: 'Elastica'
# Default analysis factory provides language aware analyzers. if you need nGram analyzers you
# can use the provided nGramAnalysisFactory by overriding the following parameter.
#kunstmaan_search.search.factory.analysis.class: Kunstmaan\SearchBundle\Search\NGramAnalysisFactory
# Ofcourse you can also provide your own implementation as long as it implements the
# AnalysisFactoryInterface. More information can be found in the
# documentation of this SearchBundle
services:
kunstmaan_search.search:
class: Kunstmaan\SearchBundle\Search\Search
arguments: ['@kunstmaan_search.search_provider_chain', '%kunstmaan_search.index_prefix%', '%kunstmaan_search.search_provider%']
kunstmaan_search.search.factory.analysis:
class: Kunstmaan\SearchBundle\Search\LanguageAnalysisFactory
public: true

And referenced the same way in the doc:

### Language Analyzer
The default analyzer is a language intelligent analyzer who only analyzes real
words and conjugations. This is a great default and for normal search forms
this will be the perfect fit.
Default configuration:
```YAML
parameters:
kunstmaan_search.search.factory.analysis.class: Kunstmaan\SearchBundle\Search\LanguageAnalysisFactory
```
### NGram Analyzer
The second analyzer the bundles provides is an nGram based analyzer. This
analyzer is not language intelligent but splits everything in little chunks of
words to be searched on. This can be very helpful for a google-like search
implementation but is slower and more cpu intensive than word based search.
nGram configuration
```YAML
parameters:
kunstmaan_search.search.factory.analysis.class: Kunstmaan\SearchBundle\Search\NGramAnalysisFactory
```

I overrode the definition in my project with no issues (after deleting/rebuilding the indices)

kunstmaan_search.search.factory.analysis:
        class: Kunstmaan\SearchBundle\Search\NGramAnalysisFactory
        public: true

And have also modified the services.yml file noted above by defining a parameter, also with no adverse results (ie. aligns to what the docs say)

parameters:
    kunstmaan_search.search_provider: 'Elastica'
    kunstmaan_search.search.factory.analysis.class: Kunstmaan\SearchBundle\Search\NGramAnalysisFactory

services:
    kunstmaan_search.search.factory.analysis:
        class: '%kunstmaan_search.search.factory.analysis.class%'
        public: true

I'm unsure of why it got hardcoded in 9e7917d; it was a parameter in eebd820

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant