You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@solr.apache.org by Péter Király <ki...@gmail.com> on 2024/11/26 21:13:18 UTC
RAMDirectoryFactory with Solrj 9.7.0
Dear all,
I am developing an application that intensively use Apache Solr, that
among others makes library catalogue records searchable. In order to
test indexing features of the application I wrote some junit test that
utilied EmbeddedSolr server. The intention is that these tests create
im memory indexes (using core.RAMDirectoryFactory). Recently every
Solr update modified some part of the API methods these tests call,
but so far I was able to solve the problems. Right now I run into an
error message I am not able to solve, and I looking for suggestion.
The solrconfig.xml is the following:
<?xml version="1.0" encoding="UTF-8" ?>
<config>
<luceneMatchVersion>9.11</luceneMatchVersion>
<indexConfig>
<useCompoundFile>${useCompoundFile:false}</useCompoundFile>
<lockType>${solr.lock.type:single}</lockType>
</indexConfig>
<dataDir>${solr.data.dir:data}</dataDir>
<directoryFactory class="org.apache.solr.core.RAMDirectoryFactory" />
<schemaFactory class="ClassicIndexSchemaFactory"/>
<updateHandler class="solr.DirectUpdateHandler2">
<updateLog>
<str name="dir">${solr.data.dir:}</str>
</updateLog>
</updateHandler>
<requestDispatcher>
<requestParsers enableRemoteStreaming="false"
multipartUploadLimitInKB="-1" />
</requestDispatcher>
<requestHandler name="/select" class="solr.SearchHandler"/>
<initParams path="/select">
<lst name="defaults">
<str name="df">name</str>
</lst>
</initParams>
</config>
The error message I got:
org.apache.solr.common.SolrException: Unable to create core [<core name>]
...
caused by org.apache.solr.common.SolrException: RAMDirectory can only
be used with the 'single' lock factory type.
The same happens if I use
<directoryFactory class="org.apache.solr.core.RAMDirectoryFactory">
<str name="lockType">single</str>
</directoryFactory>
or
<directoryFactory class="org.apache.solr.core.RAMDirectoryFactory">
<str name="rawLockType">single</str>
</directoryFactory>
Do you have any suggestion, or do you have similar use case that I can check?
Thanks a lot in advance,
Péter
--
Péter Király
software developer
GWDG, Göttingen - Europeana - eXtensible Catalog - The Code4Lib Journal
http://linkedin.com/in/peterkiraly
Re: RAMDirectoryFactory with Solrj 9.7.0
Posted by Gus Heck <gu...@gmail.com>.
IIRC the ByteBuffersDirectoryFactory is what new code should be using:
https://issues.apache.org/jira/browse/SOLR-12861
On Tue, Nov 26, 2024 at 4:13 PM Péter Király <ki...@gmail.com> wrote:
> Dear all,
>
> I am developing an application that intensively use Apache Solr, that
> among others makes library catalogue records searchable. In order to
> test indexing features of the application I wrote some junit test that
> utilied EmbeddedSolr server. The intention is that these tests create
> im memory indexes (using core.RAMDirectoryFactory). Recently every
> Solr update modified some part of the API methods these tests call,
> but so far I was able to solve the problems. Right now I run into an
> error message I am not able to solve, and I looking for suggestion.
>
> The solrconfig.xml is the following:
>
> <?xml version="1.0" encoding="UTF-8" ?>
> <config>
> <luceneMatchVersion>9.11</luceneMatchVersion>
> <indexConfig>
> <useCompoundFile>${useCompoundFile:false}</useCompoundFile>
> <lockType>${solr.lock.type:single}</lockType>
> </indexConfig>
> <dataDir>${solr.data.dir:data}</dataDir>
> <directoryFactory class="org.apache.solr.core.RAMDirectoryFactory" />
> <schemaFactory class="ClassicIndexSchemaFactory"/>
>
> <updateHandler class="solr.DirectUpdateHandler2">
> <updateLog>
> <str name="dir">${solr.data.dir:}</str>
> </updateLog>
> </updateHandler>
>
> <requestDispatcher>
> <requestParsers enableRemoteStreaming="false"
> multipartUploadLimitInKB="-1" />
> </requestDispatcher>
>
> <requestHandler name="/select" class="solr.SearchHandler"/>
>
> <initParams path="/select">
> <lst name="defaults">
> <str name="df">name</str>
> </lst>
> </initParams>
> </config>
>
> The error message I got:
> org.apache.solr.common.SolrException: Unable to create core [<core name>]
> ...
> caused by org.apache.solr.common.SolrException: RAMDirectory can only
> be used with the 'single' lock factory type.
>
> The same happens if I use
>
> <directoryFactory class="org.apache.solr.core.RAMDirectoryFactory">
> <str name="lockType">single</str>
> </directoryFactory>
>
> or
>
> <directoryFactory class="org.apache.solr.core.RAMDirectoryFactory">
> <str name="rawLockType">single</str>
> </directoryFactory>
>
> Do you have any suggestion, or do you have similar use case that I can
> check?
>
> Thanks a lot in advance,
> Péter
>
> --
> Péter Király
> software developer
> GWDG, Göttingen - Europeana - eXtensible Catalog - The Code4Lib Journal
> http://linkedin.com/in/peterkiraly
>
--
http://www.needhamsoftware.com (work)
https://a.co/d/b2sZLD9 (my fantasy fiction book)
Re: RAMDirectoryFactory with Solrj 9.7.0
Posted by Jan Høydahl <ja...@cominvent.com>.
You might want to try org.apache.solr.core.MockDirectoryFactory in your tests when using embedded. See https://github.com/apache/solr/pull/2598 for a similar issue in the main tests.
Jan
> 26. nov. 2024 kl. 22:13 skrev Péter Király <ki...@gmail.com>:
>
> Dear all,
>
> I am developing an application that intensively use Apache Solr, that
> among others makes library catalogue records searchable. In order to
> test indexing features of the application I wrote some junit test that
> utilied EmbeddedSolr server. The intention is that these tests create
> im memory indexes (using core.RAMDirectoryFactory). Recently every
> Solr update modified some part of the API methods these tests call,
> but so far I was able to solve the problems. Right now I run into an
> error message I am not able to solve, and I looking for suggestion.
>
> The solrconfig.xml is the following:
>
> <?xml version="1.0" encoding="UTF-8" ?>
> <config>
> <luceneMatchVersion>9.11</luceneMatchVersion>
> <indexConfig>
> <useCompoundFile>${useCompoundFile:false}</useCompoundFile>
> <lockType>${solr.lock.type:single}</lockType>
> </indexConfig>
> <dataDir>${solr.data.dir:data}</dataDir>
> <directoryFactory class="org.apache.solr.core.RAMDirectoryFactory" />
> <schemaFactory class="ClassicIndexSchemaFactory"/>
>
> <updateHandler class="solr.DirectUpdateHandler2">
> <updateLog>
> <str name="dir">${solr.data.dir:}</str>
> </updateLog>
> </updateHandler>
>
> <requestDispatcher>
> <requestParsers enableRemoteStreaming="false"
> multipartUploadLimitInKB="-1" />
> </requestDispatcher>
>
> <requestHandler name="/select" class="solr.SearchHandler"/>
>
> <initParams path="/select">
> <lst name="defaults">
> <str name="df">name</str>
> </lst>
> </initParams>
> </config>
>
> The error message I got:
> org.apache.solr.common.SolrException: Unable to create core [<core name>]
> ...
> caused by org.apache.solr.common.SolrException: RAMDirectory can only
> be used with the 'single' lock factory type.
>
> The same happens if I use
>
> <directoryFactory class="org.apache.solr.core.RAMDirectoryFactory">
> <str name="lockType">single</str>
> </directoryFactory>
>
> or
>
> <directoryFactory class="org.apache.solr.core.RAMDirectoryFactory">
> <str name="rawLockType">single</str>
> </directoryFactory>
>
> Do you have any suggestion, or do you have similar use case that I can check?
>
> Thanks a lot in advance,
> Péter
>
> --
> Péter Király
> software developer
> GWDG, Göttingen - Europeana - eXtensible Catalog - The Code4Lib Journal
> http://linkedin.com/in/peterkiraly