Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NPE in com.codefork.refine.solr.Solr #30

Open
braiam opened this issue Nov 1, 2022 · 2 comments
Open

NPE in com.codefork.refine.solr.Solr #30

braiam opened this issue Nov 1, 2022 · 2 comments

Comments

@braiam
Copy link

braiam commented Nov 1, 2022

Trying to reconciliate using Solr as backend leads to a null pointer exception for every query, example:

2022-11-01 11:48:29.865 ERROR 13338 --- [pool-5-thread-3] com.codefork.refine.solr.Solr            : error for query=Monte Cristi

java.lang.NullPointerException: null
	at com.codefork.refine.solr.Solr.createURL(Solr.java:57) ~[classes!/:3.1.0]
	at com.codefork.refine.solr.Solr.search(Solr.java:63) ~[classes!/:3.1.0]
	at com.codefork.refine.datasource.WebServiceDataSource.searchCheckCache(WebServiceDataSource.java:272) ~[classes!/:3.1.0]
	at com.codefork.refine.datasource.WebServiceSearchTask.call(WebServiceSearchTask.java:45) ~[classes!/:3.1.0]
	at com.codefork.refine.datasource.WebServiceSearchTask.call(WebServiceSearchTask.java:15) ~[classes!/:3.1.0]
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[na:na]
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) ~[na:na]
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[na:na]
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) ~[na:na]
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) ~[na:na]
	at java.base/java.lang.Thread.run(Thread.java:829) ~[na:na]

The configuration is simple:

cache.enabled=true
cache.ttl=3600
cache.size=64MB

datasource.solr.name=A Solr Second Level administrative division of Dominican Republic
datasource.solr.nametype.id=/location/location
datasource.solr.nametype.name=Geographic Name
datasource.solr.url.query=http://localhost:8983/solr/iso_adm2_dom/select?wt=xml&df=nombre_provincia&fl=id%20score%20nombre_provincia&q={{QUERY}}&rows={{ROWS}}&sort=score%20desc
datasource.solr.url.document=http://localhost:8983/solr/iso_adm2_dom/get?id={{id}}
datasource.solr.field.id=id
datasource.solr.field.name=nombre_provincia

The solr backend has zero problem responding to the queries:

➜  ~ curl http://localhost:8983/solr/iso_adm2_dom/select\?wt\=xml\&df\=nombre_provincia\&fl\=id%20score%20nombre_provincia\&q\=Monte%20Cristi\&rows=5\&sort=score%20desc
<?xml version="1.0" encoding="UTF-8"?>
<response>

<lst name="responseHeader">
  <int name="status">0</int>
  <int name="QTime">46</int>
  <lst name="params">
    <str name="q">Monte Cristi</str>
    <str name="df">nombre_provincia</str>
    <str name="fl">id score nombre_provincia</str>
    <str name="sort">score desc</str>
    <str name="rows">5</str>
    <str name="wt">xml</str>
  </lst>
</lst>
<result name="response" numFound="2" start="0" maxScore="3.966993" numFoundExact="true">
  <doc>
    <str name="id">15</str>
    <str name="nombre_provincia">Monte Cristi</str>
    <float name="score">3.966993</float></doc>
  <doc>
    <str name="id">29</str>
    <str name="nombre_provincia">Monte Plata</str>
    <float name="score">1.8048377</float></doc>
</result>
</response>
@braiam
Copy link
Author

braiam commented Nov 1, 2022

Found the problem, I was running java from another directory where conciliator.properties doesn't exist. A hint would be helpful for those cases.

@codeforkjeff
Copy link
Owner

That's a good idea--I think I can add some logging to warn when the API route for Solr is used but it's not configured. Keeping this issue open for that. Thank you for reporting this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants