Closed setokk closed 9 months ago
Hi @setokk I am a new contributor to this repo. Unfortunately, I don't have both Windows 10 and Arch Linux. However, I ran the sample code above in the below setting and was able to see the output. It did not behave like you described above for me. Try to move the data and index location to the project folder and see if that resolves the issue.
OS: Debian 12 Lucene Version: Lucene 9.8.0 JDK Version: openjdk 21.0.1
Command
java -classpath test.jar org.eample.Main
Output
/temp/index
/temp/data.txt
Dec 25, 2023 1:46:15 AM org.apache.lucene.store.MemorySegmentIndexInputProvider <init>
INFO: Using MemorySegmentIndexInput with Java 21; to disable start with -Dorg.apache.lucene.store.MMapDirectory.enableMemorySegments=false
Rebuilding index...
0
Done!
1 documents indexed.
I tried but to no avail. I'm using maven for packaging the app in .jar.
Folder structure:
Output:
I mvn cleaned to see if there were any problems related to that but still the same output.
FSDirectory should create the index folder automatically.
The problem is that your packaging as JAR does not preserve all required files.
See here for instructions: #12307, especially this comment: https://github.com/apache/lucene/issues/12307#issuecomment-1803320694
It looks like you suppress some exceptions. The problem is that it does not find all classes to support java 21 and/or the index codecs are not found.
Make sure that all META-INF files and the flag "Multi-Release: true" is part of you manifest.
Most likely you see this issue due to broken Maven tooling: https://issues.apache.org/jira/browse/MSHADE-385
Thanks! Adding the line "Multi-Release: true" to the MANIFEST.MF file and creating a "org.apache.lucene.codecs.PostingsFormat" file into the "META-INF/services" directory solved the issue. Happy Holidays!
creating a "org.apache.lucene.codecs.PostingsFormat" file into the "META-INF/services" directory solved the issue.
You shouldn't manually create those files. Use https://maven.apache.org/plugins/maven-shade-plugin/examples/resource-transformers.html#ServicesResourceTransformer for that.
Happy holidays.
Description
Hello!
I use the FSDirectory.open(Path path) method when building the index.
When I run this method while not being in a jar, it works as intended. But as soon as I package into a .jar file, it gets stuck at FSDirectory.open(Path path).
I outputted the absolute paths of the files (dataFile and idxDir) and they were correct.
The weird thing is no exception is thrown. It just gets stuck. The method is called in the background from a SwingWorker but that shouldn't affect it really since it works well when I just run it from my IDE.
Not 100% sure if this is a bug but it seems weird that it just gets stuck and nothing is thrown while the file paths are correct.
Thanks for reading!
Here is my search engine init method:
Version and environment details
OS: Windows 10, Arch Linux Lucene Version: Lucene 9.8.0 JDK Version: openjdk 21.0.1