Class TurLuceneUtils

java.lang.Object
com.viglet.turing.lucene.TurLuceneUtils

public final class TurLuceneUtils extends Object
Static utilities for Lucene core (index directory) management. Mirrors TurSolrUtils for the Lucene engine.

In Lucene, a "core" corresponds to a directory on the filesystem that contains a Lucene index. The basePath is the value of TurSEInstance.endpointUrl for Lucene-backed SE instances.

Field management is intentionally a no-op: Lucene is schema-less and field types are tracked in the Turing JPA model (TurSNSiteField).

Since:
2026.1
Author:
Alexandre Oliveira
  • Method Details

    • createCore

      public static void createCore(String basePath, String coreName)
      Creates the directory for a Lucene core.
      Parameters:
      basePath - the root path of the Lucene SE instance (endpointUrl)
      coreName - the core name (sub-directory)
    • deleteCore

      public static void deleteCore(String basePath, String coreName)
      Deletes the directory (and all index files) for a Lucene core.
      Parameters:
      basePath - the root path of the Lucene SE instance (endpointUrl)
      coreName - the core name (sub-directory)
    • coreExists

      public static boolean coreExists(String basePath, String coreName)
      Returns true if the given core directory exists and is a directory.
    • listCores

      public static List<TurSECoreInfo> listCores(String basePath)
      Lists all direct sub-directories of basePath as cores. Returns basic info: name and approximate doc count (not exact without opening the index).
    • addOrUpdateField

      public static void addOrUpdateField(String basePath, String coreName, String fieldName)
      No-op for Lucene: field types are tracked in the JPA model; the index itself is schema-less and accepts any field at index time.
    • deleteField

      public static void deleteField(String basePath, String coreName, String fieldName)
      No-op for Lucene: removing a field definition only requires updating the JPA model — existing indexed values are not retroactively removed.