Robert
Robert

Reputation: 3

Hibernate Search cannot set default tokenizer

i have created a custom analyzer, which I want to be now the default one. My analyzer looks like:

@AnalyzerDef(name="customanalyzer",
tokenizer = @TokenizerDef(factory = WhitespaceTokenizerFactory.class),
filters = {
    @TokenFilterDef(factory = LowerCaseFilterFactory.class),
})

and it works great. But I must write on each entity

@Analyzer(definition = "customanalyzer")

which I don't want to.

So I tried to put my analyzer into my application.yml It works perfectly for the filter but not for the tokenizer

My application.yml looks like:

spring:
  ...
  jpa:
    hibernate:
      ...
    properties:
      hibernate:
        search:
          default:
            directory_provider: filesystem
            indexBase: [removed]
          analyzer:
            tokenizer: WhitespaceTokenizerFactory   <-- this line is not working
            filter: LowerCaseFilterFactory

Can someone help me? Thanks in advance

Upvotes: 0

Views: 231

Answers (1)

Sanne
Sanne

Reputation: 6107

You can set the default analyzer for all your entities using the configuration property:

hibernate.search.analyzer=customanalyzer

Upvotes: 2

Related Questions