0

Is there any way to browse / explore Lucene index created by Hibernate Search? I am aware of Luke embedded inside Lucene bundle, but such a shitty software is unable to open my index. Here is what I have:

  • Spring Boot 2.4.4
  • Hibernate Core 5.4.30.Final
  • Hibernate Search 5.11.8.Final
  • Lucene 8.8.1
  • Java 1.8
  • Windows 10

Any attempt to open my index end up with an exception such a "Unknown error" or such a nonsense. Also I don't know what directory implementation I have as I use Hibernate Search without configuring directory implementation. Thanks!

[2021-04-11T02:26:17,500] ERROR (OpenIndexDialogFactory.java:355) - Error opening index or directory
java.lang.UnsatisfiedLinkError: no WindowsDirectory in java.library.path: [C:\Program Files\Java\jdk-11.0.10\bin, C:\WINDOWS\Sun\Java\bin, C:\WINDOWS\system32, C:\WINDOWS, C:\Program Files\Common Files\Oracle\Java\javapath, C:\Program Files (x86)\Common Files\Oracle\Java\javapath...

[2021-04-11T02:26:31,751]  INFO (IndexUtils.java:121) - DirectoryReader successfully opened. Directory path=F:\storage\TheVegCat.development\lucene\com.thevegcat.app.entities.article.Article
[2021-04-11T02:26:35,757]  INFO (IndexUtils.java:161) - Directory successfully closed.
[2021-04-11T02:26:35,760]  WARN (IndexUtils.java:145) - Invalid directory implementation class: org.apache.lucene.store.NativeUnixDirectory
java.lang.NoSuchMethodException: org.apache.lucene.store.NativeUnixDirectory.(java.nio.file.Path)
    at java.lang.Class.getConstructor0(Class.java:3349) ~[?:?]
    at java.lang.Class.getConstructor(Class.java:2151) ~[?:?]

[2021-04-11T02:26:36,779] ERROR (OpenIndexDialogFactory.java:355) - Error opening index or directory
java.lang.IllegalArgumentException: Invalid directory implementation class: org.apache.lucene.store.NativeUnixDirectory

EDIT: Tried all options and directory implementations with older Luke 5.5.0 as adviced by @andrewjames, but no luck.

C:\...\luke-5.5.0>java -jar .\target\luke-with-deps.jar
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.apache.lucene.store.MMapDirectory$1 (file:/C:/.../luke-5.5.0/target/luke-with-deps.jar) to method java.nio.DirectByteBuffer.cleaner()
WARNING: Please consider reporting this to the maintainers of org.apache.lucene.store.MMapDirectory$1
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
ERROR: java.lang.Exception: there is no valid Lucene index in this directory.

P.S. The index is only 500 KB of size and I'm willing to share it with anyone who can give it a try.

horvoje
  • 643
  • 6
  • 21
  • 1
    Hibernate Search tends to use older versions of Lucene under the covers. According to [this](https://hibernate.org/search/releases/5.11/), your version is using Lucene 5.5 - not Lucene 8. If you are using the version of Luke bundled with Lucene 8 then, yes, I would expect it to fail to open an index built using Lucene 5.5. Can you confirm that you are actually using Lucene 8.8.1 (as listed in the question)? – andrewJames Apr 11 '21 at 01:11
  • 1
    In case that is your issue, you can find older versions of Luke [here](https://github.com/DmitryKey/luke/releases/tag/luke-5.5.0). (Newer versions are bundled with Lucene, now - but they did not used to be.) – andrewJames Apr 11 '21 at 01:18
  • @andrewjames Thanks! But I would not expect to fail but to support more tnan exactly one version of the only thing it uses. I mean how hard can it be to support current older version in parallel with current version? Nevermind that, I'll try with older versions and I hope there is at least support for minior versions inside same luke build – horvoje Apr 11 '21 at 14:30
  • @andrewjames Just tried it and of course, nothing happened. Tried all options with all directories and the only thing I got is an error message. The contents of the error message will be in the main post. – horvoje Apr 11 '21 at 15:06
  • Which exact version of Lucene are you using? It may be 5.5.x, where x is not 0. In my case I get 5.5.5 as the version bundled with Hibernate 5.11.8. Also, see this: [How to read lucene 5.5.5 index?](https://stackoverflow.com/questions/48788263/how-to-read-lucene-5-5-5-index). That suggests you try Luke 6.6.0 for Lucene 5.5.5 indexes. – andrewJames Apr 11 '21 at 16:33

1 Answers1

1

Well, the magic answer it to restart Luke after each failed attempt to open a directory. Once you get an exception, close Luke and start it again.

horvoje
  • 643
  • 6
  • 21