-
Notifications
You must be signed in to change notification settings - Fork 13
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
Example using Hibernate Search #36
base: master
Are you sure you want to change the base?
Conversation
Really appreciate this @aklish works for me now, having looked at the settings, I guess the setting below did the trick. hibernate.search.default.locking_strategy=single This is how I am overriding, you are conditionally adding ConfigDataStore, wouldn't that automatically be set?
|
So I can see the index is created and lucene files being created in the correct directory path. However when I search, its still firing a Hibernate query to the database. Is my understanding wrong on how this should behave or my query is incorrect? Employee.java
|
Probably because the ngram min size is three: @parameter(name = "minGramSize", value = "3") Try adding more characters to your filter. |
I have added more characters to the query like so emailAddress=='ala*', emailAddress=='john' but no luck, still firing a hibernate query. |
@chirdeeptomar That explains why the DB query is happening. |
Here is more information about projections in Hibernate search: "Hibernate Search extracts the properties from the Lucene index and convert them back to their object representation, returning a list of Object[]. Projections avoid a potential database round trip (useful if the query response time is critical), but has some constraints: the properties projected must be stored in the index (@field(store=Store.YES)), which increase the index size the properties projected must use a FieldBridge implementing org.hibernate.search.bridge.TwoWayFieldBridge or org.hibernate.search.bridge.TwoWayStringBridge, the latter being the simpler version. All Hibernate Search built-in types are two-way. you can only project simple properties of the indexed entity or its embedded associations. This means you cannot project a whole embedded entity. projection does not work on collections or maps which are indexed via @IndexedEmbedded" |
If you store all of the entity fields inside the lucene index (to avoid the database query), the index will become quite large. Furthermore, not all fields can be stored anyway (see limitations above). Querying lucene to identify the objects in the database - followed by a subsequent query to fetch those objects is a good tradeoff IMO. |
Do Not Merge - Example
I confirm that this contribution is made under the terms of the license found in the root directory of this repository's source tree and that I have the authority necessary to make this contribution on behalf of its copyright owner.