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 8660433
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T16:15:07+00:00 2026-06-12T16:15:07+00:00

I am using Hibernate Search with conditional indexing on one of the entity classes.

  • 0

I am using Hibernate Search with conditional indexing on one of the entity classes. The @Indexed annotation for that entity specifies a custom interceptor, which prevents instances in a certain state from being indexed.

This is working perfectly as expected. However, I notice that when I use a MassIndexer to reindex everything, it ignores my custom interceptor on that entity class. I’ve confirmed through debug mode that the interceptor is never even invoked, and all instances of that entity are indexed even when they fit the criteria for being skipped.

Am I missing something? Is there a method for reindexing in Hibernate Search that DOES utilize any custom interceptors on the entity classes?

UPDATE

I have tried switching to the “old style” approach suggested by Sanne, using this code snippet:

FullTextSession fullTextSession = Search.getFullTextSession(session);
fullTextSession.setFlushMode(FlushMode.MANUAL);
fullTextSession.setCacheMode(CacheMode.IGNORE);
fullTextSession.beginTransaction();

// Kill the current index
fullTextSession.purgeAll(MyEntity.class);
int batchSize = 10;
ScrollableResults results = fullTextSession.createCriteria(MyEntity.class)
        .setFetchSize(batchSize)
        .scroll(ScrollMode.FORWARD_ONLY);
int index = 0;
while(results.next()) {

    // Re-index entites in batches of 10, freeing up memory after each batch
    index++;
    fullTextSession.index(results.get(0));
    if (index % batchSize == 0) {
        fullTextSession.flushToIndexes();
        fullTextSession.clear();
    }
}
fullTextSession.getTransaction().commit();

However, I am seeing the exact same behavior as I was with MassIndexer. The conditional mapping interceptor on MyEntity is not invoked, and all MyEntity instances are indexed whether they should be or not.

  • 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-12T16:15:08+00:00Added an answer on June 12, 2026 at 4:15 pm

    No there is not: HSEARCH-1190.

    Working on it, contributions and testers welcome!

    You could use old-style indexing using a forward-only scrollable until that’s fixed: Using flushToIndexes()

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

Sidebar

Related Questions

I am using Hibernate Search and applied Lucene indexing on one table for a
I'm using Hibernate Search (which uses Lucene) for searching some Data I have indexed
I have indexed my database using Hibernate Search. I use a custom analyzer, both
I am using hibernate search with solr in my project and one of my
I have an app that I'm attempting to integrate hibernate search into. I'm using
We are using Hibernate search to search the lucene index annoted in my entity.
I have a combination of search criteria which implemented by using hibernate criteria. And
Using Hibernate how would you design and implement a search criteria page (which has
Using Hibernate Search Annotations (mostly just @Field(index = Index.TOKENIZED) ) I've indexed a number
I've configured with hibernate-search annotation (4.1.1 version library) my class Intervento. So, I'm using

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.