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 <kirun...@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

Reply via email to