Apache Solr Tips And Tricks

As seen in the previous blog post about Apache Solr Learning to Rank Feature and Model Stores, there are many operations we can do with feature stores and model stores in Apache Solr.

On this page, I would like to focus on the main errors that can arise in using those methods and of which we have to be aware.

Reload

The first thing that could happen is that we upload our feature store or model but we don’t see the new components in the corresponding feature-store or model-store.

Every change made on these two stores need the collection to be reloaded in order to see the results, therefore:

After uploading the feature store to the feature-store, it is important to reload the collection in order to successfully apply the changes.
After uploading the model to the model-store, it is important to reload the collection in order to successfully apply the changes.

The same for the deletion of a feature store or model:

After deleting the desired feature storeit is important to reload the collection in order to successfully apply the changes.
After deleting the desired model, it is important to reload the collection in order to successfully apply the changes.

How to reload the collection :

http://localhost:8983/solr/admin/collections?action=RELOAD&name=newCollection

Reload

A possible error that could arise during the upload of an Apache Solr model is:

org.apache.solr.ltr.model.ModelException: Model type does not exist org.apache.solr.ltr.model.MultipleAdditiveTreesModel

This is due to the fact that we are uploading a model that uses a wrong or inexistent feature store.

To make an example.

Suppose we have this feature-store:

{
  "responseHeader": {
       "status": 0,
       "QTime": 160
  },
  "featureStores": [
      "first_store",
      "second_store"
  ]
}

And suppose we are uploading this model:

{
    "store": "third_store",
    "name": "first_model",
    "class": "org.apache.solr.ltr.model.MultipleAdditiveTreesModel",
    "features": [
        {
            "name": "feature_1"
        },
        {
            "name": "feature_2"
        },
        {
            "name": "feature_3"
        },
....

This process will raise an exception since the “store” field of the model doesn’t match with any store name in the feature-store.

In this case, we need to load the feature store first and then the model.
Be sure that the “store” field in the model matches the correct store “name” in the feature-store.

Error in feature deletion

We have to be careful also when deleting a feature store.

If we delete a used feature store, at the moment of the collection reload we will obtain this error:

org.apache.solr.common.SolrException:org.apache.solr.common.SolrException: Failed to create new
ManagedResource /schema/model-store of type org.apache.solr.ltr.store.rest.ManagedModelStore due to: org.apache.solr.common.SolrException: org.apache.solr.ltr.model.ModelException: Model type does not exist org.apache.solr.ltr.model.MultipleAdditiveTreesModelorg.apache.solr.client.solrj.impl.
HttpSolrClient$RemoteSolrException:Error from server at http://10.0.0.23:8983/solr: Unable to reload core [adore_solr_shard1_replica_n1]org.apache.solr.common.SolrException:org.apache.solr.common.SolrException:
Failed to create new ManagedResource /schema/model-store of type
org.apache.solr.ltr.store.rest.ManagedModelStore due to: org.apache.solr.common.SolrException: org.apache.solr.ltr.model.ModelException:
Model type does not exist org.apache.solr.ltr.model.MultipleAdditiveTreesModel

And in the Solr User Interface we will find this banner on the top of the page:

org.apache.solr.common.SolrException:org.apache.solr.common.SolrException: Failed to create new ManagedResource /schema/model-store of type org.apache.solr.ltr.store.rest.ManagedModelStore due to: org.apache.solr.common.SolrException: org.apache.solr.ltr.model.ModelException: Model type does not exist org.apache.solr.ltr.model.MultipleAdditiveTreesModel

This is because now the model that was using the deleted feature store doesn’t find its reference to the store.

It is always best to remove the model first and then, if necessary, the corresponding feature store.
A feature store can be deleted only when there are no models using it.

Pay attention to Apache ZooKeeper

Another issue that could arise is related to ZooKeeper file limit.
From the documentation:

https://lucene.apache.org/solr/guide/8_8/setting-up-an-external-zookeeper-ensemble.html#increasing-the-file-size-limit

It could indeed happen that you can’t see the feature store or model you uploaded even after the reload of the collection.

We can see that the default file size limit that ZooKeeper can manage is 1MB. This may be too small when loading your learning to rank model and therefore can lead to upload problems. If the file can’t be uploaded due to its size, we will not be able to see it in the feature-store/model-store.

Check the dimension of the feature/model file you want to upload to Solr.
If necessary increase the ZooKeeper file size limit.

JVM Heap Memory Usage

Another thing to keep under control is the JVM Heap Memory usage.
The required memory for feature stores and models management could be high and we can saturate the available one like.

In this image we can see an example of this behavior. At 9:12 we saturate the memory till the 9:18.

Check the JVM heap memory usage during stores and models management.
If necessary increase the memory size.

Great news!

Thanks to Alessandro Benedetti‘s contribution, the errors that can arise with model upload and feature deletion are going to be much more readable and clear in the next Solr 8.9 version!
You can see the new changes in the Jira issue: https://issues.apache.org/jira/browse/SOLR-15149

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut elit tellus, luctus nec ullamcorper mattis, pulvinar dapibus leo.

// our service

Shameless plug for our training and services!

Did I mention we do Learning To Rank and Apache Solr Beginner training?
We also provide consulting on these topics, get in touch if you want to bring your search engine to the next level!

// STAY ALWAYS UP TO DATE

Subscribe to our newsletter

Did you like this post about Common Errors with Apache Solr Feature and Model Stores? Don’t forget to subscribe to our Newsletter to stay always updated from the Information Retrieval world!

 

Author

Anna Ruggero

Anna Ruggero is a software engineer passionate about Information Retrieval and Data Mining. She loves to find new solutions to problems, suggesting and testing new ideas, especially those that concern the integration of machine learning techniques into information retrieval systems.

Comments (2)

  1. Sunit
    September 28, 2021

    Hi, I am kind of stuck with following error since long, I tried all possible ways mentioned in the blog and elsewhere but still no luck. Point to add here at the beginning my feature and model worked fine and all looked good.

    My question are
    1 What are the ways to recover the core without loosing the data and still have store enabled.
    2. Where the uploaded feature / model config resides, Is there a way to remove it manually ?
    3. Is there a way to clear the custom LRU cache used for LRT. ?

    Failed to create new ManagedResource /schema/model-store of type org.apache.solr.ltr.store.rest.ManagedModelStore due to: org.apache.solr.common.SolrException: org.apache.solr.ltr.model.ModelException: Model type does not exist org.apache.solr.ltr.model.LinearModel

    • Anna Ruggero
      October 6, 2021

      Hi Sunit,
      I try to answer your questions.
      1. What do you mean by “to recover the core”? With the collection reload you are not losing any data and LTR remains enabled.
      2. You can find models and data in two files called _schema_model-store.json and _schema_feature-store.json. These files are usually in the _default folder inside the configs folder. I’ve never tried it, but you can probably change these files manually and upload them to the configuration folder using zookeeper. (if you do not want to use the proper delete API).
      3. You can clean the caches by reloading the collection. I do not think there is a way to clean only the cache you like. If you want a cache to be clean at the restart you can set the autowarming parameter to 0 for that cache.

      I hope this helps.
      Cheers!

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: