Hello and happy new year!
Indeed reverting back to 'class' attribute in place of 'name' did the trick,
now I don't see any nullpointerexception anymore.

Thank you!
Please let me know if I should fill in a bug report.

this is my stopwords.txt in conf folder, that I think is just the default:

# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements.  See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License.  You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# a couple of test stopwords to test that the words are really being
# configured from this file:
stopworda
stopwordb

# Standard english stop words taken from Lucene's StopAnalyzer
a
an
and
are
as
at
be
but
by
for
if
in
into
is
it
no
not
of
on
or
such
that
the
their
then
there
these
they
this
to
was
will
with


[cid:277c4716-1d7c-4a96-9318-48c23e88ca52]<https://www.cosbi.eu/>

Danilo Tomasoni

Data Scientist & Software Engineer
+39 0464 808845

tomas...@cosbi.eu <mailto:tomas...@cosbi.eu>

www.cosbi.eu

<http://www.cosbi.eu/>

[cid:0630e326-b691-4acc-bf43-a43fb432b3f0]<https://twitter.com/FoundationCosbi/>[cid:d5cb2551-4a0b-4dc7-9b8d-d54d727f456a]<https://www.linkedin.com/company/cosbi/>

________________________________
Da: Jan Høydahl <jan....@cominvent.com>
Inviato: venerdì 29 dicembre 2023 14:57
A: users@solr.apache.org <users@solr.apache.org>
Oggetto: Re: stopfilter nullpointerexception

[CAUTION: EXTERNAL SENDER]
[Please check correspondence between Sender Display Name and Sender Email 
Address before clicking on any link or opening attachments]


Hi,

It is indeed an empty (null) stopwords "CharArraySet" being passed in 
https://github.com/apache/lucene/blob/branch_9_8/lucene/core/src/java/org/apache/lucene/analysis/StopFilter.java#L39

If you flip back to class="solr.StopFilterFactory", does it work then?
Does your stopwords.txt file contain any stopwords or is the file empty?

There may be subtle difference in classloader / resourceLoader behavior when 
loaded with "class" vs "name", if so this is likely a bug to be investigated.

Jan

> 29. des. 2023 kl. 09:23 skrev Danilo Tomasoni <tomas...@cosbi.eu>:
>
> Hello all again,
> I have a problem indexing new documents in my upgraded solr version (from 
> 8.11 to 9.4)
> I changed the solrconfig.xml to adhere the recent syntax:
>         <filter class="solr.StopFilterFactory" ignoreCase="true" 
> words="stopwords.txt" />
> was changed to
>         <filter name="stop" ignoreCase="true" words="stopwords.txt" />
>
> The core loads correctly, but when I try to index a document I see an error 
> in the logs
>
> 2023-12-29 07:46:38.191 ERROR (qtp2035381640-19) [ x:COSBIBioIndexTest 
> t:localhost-41] o.a.s.h.RequestHandlerBase Client exception => 
> org.apache.solr.common.SolrException: Exception writing document id 
> PUBMEDPMC8101124 to the index; possible analysis error.
>         at 
> org.apache.solr.update.DirectUpdateHandler2.addDoc(DirectUpdateHandler2.java:335)
> ...
> Caused by: java.lang.NullPointerException: stopWords
>         at java.util.Objects.requireNonNull(Objects.java:246) ~[?:?]
>         at org.apache.lucene.analysis.StopFilter.<init>(StopFilter.java:39) 
> ~[?:?]
>         at 
> org.apache.lucene.analysis.core.StopFilter.<init>(StopFilter.java:43) ~[?:?]
>         at 
> org.apache.lucene.analysis.core.StopFilterFactory.create(StopFilterFactory.java:91)
>  ~[?:?]
>         at 
> org.apache.solr.analysis.TokenizerChain.createComponents(TokenizerChain.java:132)
>  ~[?:?]
>         at 
> org.apache.lucene.analysis.AnalyzerWrapper.createComponents(AnalyzerWrapper.java:120)
>  ~[?:?]
>         at 
> org.apache.lucene.analysis.AnalyzerWrapper.createComponents(AnalyzerWrapper.java:120)
>  ~[?:?]
>         at org.apache.lucene.analysis.Analyzer.tokenStream(Analyzer.java:193) 
> ~[?:?]
>         at org.apache.lucene.document.Field.tokenStream(Field.java:491) ~[?:?]
>         at 
> org.apache.lucene.index.IndexingChain$PerField.invertTokenStream(IndexingChain.java:1162)
>  ~[?:?]
>         at 
> org.apache.lucene.index.IndexingChain$PerField.invert(IndexingChain.java:1146)
>  ~[?:?]
>         at 
> org.apache.lucene.index.IndexingChain.processField(IndexingChain.java:697) 
> ~[?:?]
>         at 
> org.apache.lucene.index.IndexingChain.processDocument(IndexingChain.java:576) 
> ~[?:?]
>         at 
> org.apache.lucene.index.DocumentsWriterPerThread.updateDocuments(DocumentsWriterPerThread.java:242)
>  ~[?:?]
>         at 
> org.apache.lucene.index.DocumentsWriter.updateDocuments(DocumentsWriter.java:432)
>  ~[?:?]
>         at 
> org.apache.lucene.index.IndexWriter.updateDocuments(IndexWriter.java:1545) 
> ~[?:?]
>         at 
> org.apache.lucene.index.IndexWriter.updateDocuments(IndexWriter.java:1521) 
> ~[?:?]
>         at 
> org.apache.solr.update.DirectUpdateHandler2.updateDocOrDocValues(DirectUpdateHandler2.java:1062)
>  ~[?:?]
>         at 
> org.apache.solr.update.DirectUpdateHandler2.doNormalUpdate(DirectUpdateHandler2.java:421)
>  ~[?:?]
>         at 
> org.apache.solr.update.DirectUpdateHandler2.addDoc0(DirectUpdateHandler2.java:374)
>  ~[?:?]
>         at 
> org.apache.solr.update.DirectUpdateHandler2.addDoc(DirectUpdateHandler2.java:311)
>  ~[?:?]
>
>
> The file 'stopwords.txt' is present in the core/conf/stopwords.txt
>
> What is the issue here?
> Thank you for your help and patience
> D
>
>  <https://www.cosbi.eu/>
>
> Danilo Tomasoni
> Data Scientist & Software Engineer
> +39 0464 808845
> tomas...@cosbi.eu <mailto:tomas...@cosbi.eu>
> www.cosbi.eu<http://www.cosbi.eu>
>
>  <http://www.cosbi.eu/>
>  <https://twitter.com/FoundationCosbi/> 
> <https://www.linkedin.com/company/cosbi/>

Reply via email to