Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8705269
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T03:19:06+00:00 2026-06-13T03:19:06+00:00

I have a Person entity with multiple name related properties (firstName, lastName, title). All

  • 0

I have a Person entity with multiple name related properties (firstName, lastName, title).
All the name related properties should be stored in a single lucene index field “fullName”.

@Indexed
@Entity
public class Person {
   ...
   private String firstName;
   private String lastName;
   private String title;

   @Field(store=Store.NO, index=Index.TOKENIZED)
   public String getFullName() {
      return firstName + " " + lastName + " " + title;
   }
}

The only problem I’m facing is to automatically update the fullName in the index when a name related property is updated.

Is there some way to tell Hibernate Search that fullName is a composed field and must be updated when one of the parts changes? Maybe something like this?

@ComposedOf({"firstName", "lastName", "title"})

Thank you!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T03:19:07+00:00Added an answer on June 13, 2026 at 3:19 am
    @Indexed
    @Entity
    public class Person {
       ...
       @Field(name="fullName") String firstName;
       @Field(name="fullName") String lastName;
       @Field(name="fullName") String title;
    }
    

    This is possible as you have chosen TOKENIZED and I’m assuming your analyzer is set to split the tokens on whitespace as you’re adding whitespace to separate them: you can have multiple repetitions of a same field, the result is almost the same as splitting the compound terms
    (I say almost as it won’t be able to determine ordering of terms in case you need a PhraseQuery looking for a specific order of keywords).

    For more complex cases you would use a ClassBridge which disables the dirty-checking optimisation which has been annoying you in this case: Hibernate Search tracks if any persistent field was actually written to to decide if it can skip expensive reindexing operations but is then unable to detect such tricks.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Let's say I have a Person table with a FirstName and LastName column. I
I have an entity Person: class Person { String name; String phone; @OneToMany(cascade =
I have a Person JPA entity, and my Person has multiple addresses (OneToMany relationship
I have Person entity which has composition with Location Entity @ManyToOne(fetch = FetchType.EAGER, cascade
In my core data model I have a Person entity that has a to
I have a Person and an Organisation Entity: Person looks like this: public class
Let's say I have this entity (for Hibernate): @Entity public class Person { @Id
Suppose I have the following 2 entities: @Entity public class Person implements Serializable {
I have class Person class person{ int ID ; sting FirstName ; string Last
I have Person and Course Entities With multiple relationships: public class Course { public

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.