fatma pico
fatma pico

Reputation: 33

Hibernate search is always returning an empty list

I am developping a java/jee application in which i am using spring boot and hibernate as frameworks i used hibernate search for full text searching but unfortunately i always got an empty list as result.I am using hibernate version 5.1 and hibernate search orm version 5.5.3.Final.Here is my code :

Upvotes: 0

Views: 306

Answers (1)

Sanne
Sanne

Reputation: 6107

There are multiple kinds of full-text queries.

The keyword() query will only match exactly the same keyword, so if you pass matching("di*") it will only find instances of the Application entity which have a literal field

 reference = "di*";

Which I'm guessing is not what you meant to do.

It looks like you want a wildcard query instead?

builder.keyword().wildcard().onField( "reference" ).matching( "di*" ).createQuery()

Have a look also at the new SimpleQuery DSL: builder.simpleQueryString(), another great way to create wildcard queries.

See also:

Upvotes: 2

Related Questions