The best practice is to not set the codec explicitly, and Lucene will make
sure to always use the right one.

Seeing the codec explicitly is considered expert. I guess you are doing
this because you want to configure things like stored fields compression or
HNSW parameters? If so, there is no better way than what you are doing.


Le sam. 1 oct. 2022, 12:31, Michael Wechner <michael.wech...@wyona.com> a
écrit :

> Hi Adrien
>
> Thank you very much for your help!
>
> That was it :-) I completely forgot that I set this somewhere hidden
> inside my code.
> I made a note in the pom file, such that I should not forget again
> during the next upgrade :-)
>
> Or what is the best practice re setting / handling the codec?
>
> Thanks
>
> Michael
>
> Am 01.10.22 um 08:06 schrieb Adrien Grand:
> > I would guess that you are configuring your IndexWriterConfig with a
> > "Lucene91Codec" instance. You need to replace it with a "Lucene94Codec"
> > instance.
> >
> > Le sam. 1 oct. 2022, 06:12, Michael Wechner <michael.wech...@wyona.com>
> a
> > écrit :
> >
> >> Hi
> >>
> >> I have just upgraded from 9.1.0 to 9.4.0 and compiling works fine, but
> >> when I run and re-index my data using KnnVectorField, then I receive the
> >> following exception:
> >>
> >> java.lang.UnsupportedOperationException: Old codecs may only be used for
> >> reading
> >>       at
> >>
> org.apache.lucene.backward_codecs.lucene91.Lucene91HnswVectorsFormat.fieldsWriter(Lucene91HnswVectorsFormat.java:131)
> >>
> >> ~[lucene-backward-codecs-9.4.0.jar:9.4.0
> >> d2e22e18c6c92b6a6ba0bbc26d78b5e82832f956 - sokolovm - 2022-09-30
> 14:55:13]
> >>       at
> >>
> org.apache.lucene.codecs.perfield.PerFieldKnnVectorsFormat$FieldsWriter.getInstance(PerFieldKnnVectorsFormat.java:161)
> >>
> >> ~[lucene-core-9.4.0.jar:9.4.0 d2e22e18c6c92b6a6ba0bbc26d78b5e82832f956 -
> >> sokolovm - 2022-09-30 14:55:13]
> >>       at
> >>
> org.apache.lucene.codecs.perfield.PerFieldKnnVectorsFormat$FieldsWriter.addField(PerFieldKnnVectorsFormat.java:105)
> >>
> >> ~[lucene-core-9.4.0.jar:9.4.0 d2e22e18c6c92b6a6ba0bbc26d78b5e82832f956 -
> >> sokolovm - 2022-09-30 14:55:13]
> >>       at
> >>
> org.apache.lucene.index.VectorValuesConsumer.addField(VectorValuesConsumer.java:70)
> >>
> >> ~[lucene-core-9.4.0.jar:9.4.0 d2e22e18c6c92b6a6ba0bbc26d78b5e82832f956 -
> >> sokolovm - 2022-09-30 14:55:13]
> >>       at
> >>
> org.apache.lucene.index.IndexingChain.initializeFieldInfo(IndexingChain.java:665)
> >>
> >> ~[lucene-core-9.4.0.jar:9.4.0 d2e22e18c6c92b6a6ba0bbc26d78b5e82832f956 -
> >> sokolovm - 2022-09-30 14:55:13]
> >>       at
> >>
> org.apache.lucene.index.IndexingChain.processDocument(IndexingChain.java:556)
> >>
> >> ~[lucene-core-9.4.0.jar:9.4.0 d2e22e18c6c92b6a6ba0bbc26d78b5e82832f956 -
> >> sokolovm - 2022-09-30 14:55:13]
> >>       at
> >>
> org.apache.lucene.index.DocumentsWriterPerThread.updateDocuments(DocumentsWriterPerThread.java:241)
> >>
> >> ~[lucene-core-9.4.0.jar:9.4.0 d2e22e18c6c92b6a6ba0bbc26d78b5e82832f956 -
> >> sokolovm - 2022-09-30 14:55:13]
> >>       at
> >>
> org.apache.lucene.index.DocumentsWriter.updateDocuments(DocumentsWriter.java:432)
> >>
> >> ~[lucene-core-9.4.0.jar:9.4.0 d2e22e18c6c92b6a6ba0bbc26d78b5e82832f956 -
> >> sokolovm - 2022-09-30 14:55:13]
> >>       at
> >>
> org.apache.lucene.index.IndexWriter.updateDocuments(IndexWriter.java:1533)
> >> ~[lucene-core-9.4.0.jar:9.4.0 d2e22e18c6c92b6a6ba0bbc26d78b5e82832f956 -
> >> sokolovm - 2022-09-30 14:55:13]
> >>       at
> >>
> org.apache.lucene.index.IndexWriter.updateDocument(IndexWriter.java:1818)
> >> ~[lucene-core-9.4.0.jar:9.4.0 d2e22e18c6c92b6a6ba0bbc26d78b5e82832f956 -
> >> sokolovm - 2022-09-30 14:55:13]
> >>       at
> >> org.apache.lucene.index.IndexWriter.addDocument(IndexWriter.java:1471)
> >> ~[lucene-core-9.4.0.jar:9.4.0 d2e22e18c6c92b6a6ba0bbc26d78b5e82832f956 -
> >> sokolovm - 2022-09-30 14:55:13]
> >>
> >> Any idea what I might be doing wrong?
> >>
> >> Thanks
> >>
> >> Michael
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org
> >> For additional commands, e-mail: java-user-h...@lucene.apache.org
> >>
> >>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org
> For additional commands, e-mail: java-user-h...@lucene.apache.org
>
>

Reply via email to