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

Kevin Risden updated SOLR-10087:
--------------------------------
    Description: 
StreamHandler currently can't uses jars that via the runtimeLib and Blob Store 
api. This is because the StreamHandler uses core.getResourceLoader() instead of 
core.getMemClassLoader() for loading classes.

An example of this working with the fix is here: 
https://github.com/risdenk/solr_custom_streaming_expressions

Steps:
{code}
./bin/solr start -c -f -a "-Denable.runtime.lib=true"

# Create test collection
./bin/solr create -c test

# Create .system collection
curl 'http://localhost:8983/solr/admin/collections?action=CREATE&name=.system'

# build custom streaming expression
(cd custom-streaming-expression && mvn clean package)
# Upload jar to .system collection using Blob Store API 
(https://cwiki.apache.org/confluence/display/solr/Blob+Store+API)
curl -X POST -H 'Content-Type: application/octet-stream' --data-binary 
@custom-streaming-expression/target/custom-streaming-expression-1.0-SNAPSHOT.jar
 'http://localhost:8983/solr/.system/blob/test'

# List all blobs that are stored
curl 'http://localhost:8983/solr/.system/blob?omitHeader=true'

# Add the jar to the runtime lib
curl 'http://localhost:8983/solr/test/config' -H 
'Content-type:application/json' -d '{
   "add-runtimelib": { "name":"test", "version":1 }
}'

# Create custom streaming expression using work from 9103
# Patch from SOLR-10087 is required for StreamHandler to load the runtimeLib jar
curl 'http://localhost:8983/solr/test/config' -H 
'Content-type:application/json' -d '{
  "create-expressible": {
    "name": "customstreamingexpression",
    "class": "com.test.solr.CustomStreamingExpression",
    "runtimeLib": true
  }
}'

# Test the custom streaming expression
curl 'http://localhost:8983/solr/test/stream?expr=customstreamingexpression()'
{code}

  was:
StreamHandler currently can't uses jars that via the runtimeLib and Blob Store 
api. This is because the StreamHandler uses core.getResourceLoader() instead of 
core.getMemClassLoader() for loading classes.

An example of this working with the fix is here: 
https://github.com/risdenk/solr_custom_streaming_expressions


> StreamHandler should be able to use runtimeLib jars
> ---------------------------------------------------
>
>                 Key: SOLR-10087
>                 URL: https://issues.apache.org/jira/browse/SOLR-10087
>             Project: Solr
>          Issue Type: Improvement
>      Security Level: Public(Default Security Level. Issues are Public) 
>            Reporter: Kevin Risden
>            Assignee: Kevin Risden
>            Priority: Minor
>         Attachments: SOLR-10087.patch
>
>
> StreamHandler currently can't uses jars that via the runtimeLib and Blob 
> Store api. This is because the StreamHandler uses core.getResourceLoader() 
> instead of core.getMemClassLoader() for loading classes.
> An example of this working with the fix is here: 
> https://github.com/risdenk/solr_custom_streaming_expressions
> Steps:
> {code}
> ./bin/solr start -c -f -a "-Denable.runtime.lib=true"
> # Create test collection
> ./bin/solr create -c test
> # Create .system collection
> curl 'http://localhost:8983/solr/admin/collections?action=CREATE&name=.system'
> # build custom streaming expression
> (cd custom-streaming-expression && mvn clean package)
> # Upload jar to .system collection using Blob Store API 
> (https://cwiki.apache.org/confluence/display/solr/Blob+Store+API)
> curl -X POST -H 'Content-Type: application/octet-stream' --data-binary 
> @custom-streaming-expression/target/custom-streaming-expression-1.0-SNAPSHOT.jar
>  'http://localhost:8983/solr/.system/blob/test'
> # List all blobs that are stored
> curl 'http://localhost:8983/solr/.system/blob?omitHeader=true'
> # Add the jar to the runtime lib
> curl 'http://localhost:8983/solr/test/config' -H 
> 'Content-type:application/json' -d '{
>    "add-runtimelib": { "name":"test", "version":1 }
> }'
> # Create custom streaming expression using work from 9103
> # Patch from SOLR-10087 is required for StreamHandler to load the runtimeLib 
> jar
> curl 'http://localhost:8983/solr/test/config' -H 
> 'Content-type:application/json' -d '{
>   "create-expressible": {
>     "name": "customstreamingexpression",
>     "class": "com.test.solr.CustomStreamingExpression",
>     "runtimeLib": true
>   }
> }'
> # Test the custom streaming expression
> curl 'http://localhost:8983/solr/test/stream?expr=customstreamingexpression()'
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

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

Reply via email to