[ 
https://issues.apache.org/jira/browse/SOLR-2783?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Sujit Pal updated SOLR-2783:
----------------------------

    Description: 
We have built a custom EHCache backed implementation of SolrCache that allows 
us to spill over the cache to disk and have it persistent across Solr restarts. 
To allow disk spillover we need the key and value of the cache to be 
Serializable. So our SolrCache implementation signature is like this:

{code}
public class EhCacheSolrCache implements SolrCache<Serializable,Serializable> {
...
}
{code}

One of the things we are caching are DocSets (specifically BitDocSets). 
Currently we are wrapping it into a Serializable class of our own:

{code}
public class SerializableBitDocSet extends BitDocSet implements Serializable {

  private static final long serialVersionUID = 3723685897599896159L;

  public SerializableBitDocSet() {
    super();
  }
  
  public SerializableBitDocSet(OpenBitSet obs) {
    super(obs);
  }
{code}

and when getting or putting into the cache, we convert to the Serializable 
version using the deprecated method getBits().

{code}
SerializableBitDocSet docset = new 
SerializableBitDocSet(newSearcher.getDocSet(q).getBits());
newSearcher.getCache(CACHED_FACETS_BITSETS_CACHENAME).put(facetQuery, docset);
{code}

On the get, since a SerializableBitDocSet is a BitDocSet there is no extra work.

Two issues:
1) we are using a deprecated getBits() call to make the conversion - this is 
likely to disappear in a later version.
2) the approach is hacky, since we have to potentially subclass other bitset 
like structures to make them Serializable as well.

It would be nice if DocSet (the parent interface) can be made Serializable. 
This would allow Solr users to use this as a cache value for disk-persistent 
caches without any hackery.


  was:
We have built a custom EHCache backed implementation of SolrCache that allows 
us to spill over the cache to disk and have it persistent across Solr restarts. 
To allow disk spillover we need the key and value of the cache to be 
Serializable. So our SolrCache implementation signature is like this:
{code}
public class EhCacheSolrCache implements SolrCache<Serializable,Serializable> {
...
}
{/code}
One of the things we are caching are DocSets (specifically BitDocSets). 
Currently we are wrapping it into a Serializable class of our own:
{code}
public class SerializableBitDocSet extends BitDocSet implements Serializable {

  private static final long serialVersionUID = 3723685897599896159L;

  public SerializableBitDocSet() {
    super();
  }
  
  public SerializableBitDocSet(OpenBitSet obs) {
    super(obs);
  }
{/code}
and when getting or putting into the cache, we convert to the Serializable 
version using the deprecated method getBits().
{code}
SerializableBitDocSet docset = new 
SerializableBitDocSet(newSearcher.getDocSet(q).getBits());
newSearcher.getCache(CACHED_FACETS_BITSETS_CACHENAME).put(facetQuery, docset);
{/code}
On the get, since a SerializableBitDocSet is a BitDocSet there is no extra work.

Two issues:
1) we are using a deprecated getBits() call to make the conversion - this is 
likely to disappear in a later version.
2) the approach is hacky, since we have to potentially subclass other bitset 
like structures to make them Serializable as well.

It would be nice if DocSet (the parent interface) can be made Serializable. 
This would allow Solr users to use this as a cache value for disk-persistent 
caches without any hackery.



> Please make DocSet extend Serializable
> --------------------------------------
>
>                 Key: SOLR-2783
>                 URL: https://issues.apache.org/jira/browse/SOLR-2783
>             Project: Solr
>          Issue Type: Wish
>         Environment: Any.
>            Reporter: Sujit Pal
>            Priority: Minor
>
> We have built a custom EHCache backed implementation of SolrCache that allows 
> us to spill over the cache to disk and have it persistent across Solr 
> restarts. To allow disk spillover we need the key and value of the cache to 
> be Serializable. So our SolrCache implementation signature is like this:
> {code}
> public class EhCacheSolrCache implements SolrCache<Serializable,Serializable> 
> {
> ...
> }
> {code}
> One of the things we are caching are DocSets (specifically BitDocSets). 
> Currently we are wrapping it into a Serializable class of our own:
> {code}
> public class SerializableBitDocSet extends BitDocSet implements Serializable {
>   private static final long serialVersionUID = 3723685897599896159L;
>   public SerializableBitDocSet() {
>     super();
>   }
>   
>   public SerializableBitDocSet(OpenBitSet obs) {
>     super(obs);
>   }
> {code}
> and when getting or putting into the cache, we convert to the Serializable 
> version using the deprecated method getBits().
> {code}
> SerializableBitDocSet docset = new 
> SerializableBitDocSet(newSearcher.getDocSet(q).getBits());
> newSearcher.getCache(CACHED_FACETS_BITSETS_CACHENAME).put(facetQuery, docset);
> {code}
> On the get, since a SerializableBitDocSet is a BitDocSet there is no extra 
> work.
> Two issues:
> 1) we are using a deprecated getBits() call to make the conversion - this is 
> likely to disappear in a later version.
> 2) the approach is hacky, since we have to potentially subclass other bitset 
> like structures to make them Serializable as well.
> It would be nice if DocSet (the parent interface) can be made Serializable. 
> This would allow Solr users to use this as a cache value for disk-persistent 
> caches without any hackery.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org

Reply via email to