javaspring-boothibernatelucenehibernate-search

How can i use a builtin analyzer in my entity with Hibernate Search


i have a custom analyzer but i want to use the built in "WhitespaceAnalyzer" that Hibernate provides for this spesific field.

My field looks like this:

@FullTextField(analyzer = "WhitespaceAnalyzer", projectable = Projectable.YES, termVector = TermVector.NO)
@Column(name = "MY_FIELD")
private String myField;

when i use analyzer = "WhitespaceAnalyzer" i get an error HSEARCH000353: Unknown analyzer: 'WhitespaceAnalyzer'. Make sure you defined this analyzer.

Do i also have to define the built in analyser in the application.properties?

My main problem is that the field has values that look like this: 1#J, 2#J, 3#N and i want to index the terms separately 1#J 2#J etc and i thought i could use the WhitespaceAnalyzer for the task


Solution

  • i should have used the name "whitespace" instead of "WhitespaceAnalyzer"

    see: https://docs.jboss.org/hibernate/stable/search/reference/en-US/html_single/#backend-lucene-analysis