You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by George L <ge...@gmail.com> on 2007/09/09 18:57:09 UTC

MoreLikeThis throwing NPE

I have been trying the MLT Query using EmbeddedSolr and SolrJ clients, which
is resulting in NPE.

It looks like a problem as mentioned here
https://issues.apache.org/jira/browse/LUCENE-819
If that is the case,how to fix this?

The MLT field has been stored with termvectors.

The query i used and the exception is below.

In debug mode Lucene term.hascode() has been receiving some fields in the
index and breaking with the id field,
I was hoping to see the exception happening bcos of the mlt
fields/fieldValues. But it didn't.

Can somebody help me please, i have already spent a whole saturday night
with the trunk code ;-(

SolrQuery q = new SolrQuery();
        q.setQuery( "id:100001");
        q.addFacetField("l");
        q.setFacet(true);
        q.setFacetMinCount(1);
        q.setParam("mlt", true);
        q.setParam("mlt.fl","field1");
        q.setParam("mlt.minwl","1");
        q.setParam("mlt.mintf","1");
        q.setParam("mlt.mindf","1");
QueryResponse response = server.query( q );



SEVERE: java.lang.NullPointerException
    at org.apache.lucene.index.Term.hashCode(Term.java:78)
    at org.apache.lucene.search.TermQuery.hashCode (TermQuery.java:175)
    at org.apache.lucene.search.BooleanClause.hashCode(BooleanClause.java
:108)
    at java.util.AbstractList.hashCode(AbstractList.java:630)
    at org.apache.lucene.search.BooleanQuery.hashCode (BooleanQuery.java
:445)
    at org.apache.solr.search.QueryResultKey.<init>(QueryResultKey.java:47)
    at org.apache.solr.search.SolrIndexSearcher.getDocListC(
SolrIndexSearcher.java:725)
    at org.apache.solr.search.SolrIndexSearcher.getDocListAndSet (
SolrIndexSearcher.java:1241)
    at
org.apache.solr.handler.MoreLikeThisHandler$MoreLikeThisHelper.getMoreLikeThis
(MoreLikeThisHandler.java:280)
    at
org.apache.solr.handler.MoreLikeThisHandler$MoreLikeThisHelper.getMoreLikeThese(
MoreLikeThisHandler.java:310)
    at org.apache.solr.handler.StandardRequestHandler.handleRequestBody(
StandardRequestHandler.java:142)
    at org.apache.solr.handler.RequestHandlerBase.handleRequest(
RequestHandlerBase.java :78)
    at org.apache.solr.core.SolrCore.execute(SolrCore.java:894)
    at org.apache.solr.client.solrj.embedded.EmbeddedSolrServer.request(
EmbeddedSolrServer.java:106)
    at org.apache.solr.client.solrj.request.QueryRequest.process (
QueryRequest.java:80)
    at org.apache.solr.client.solrj.impl.BaseSolrServer.query(
BaseSolrServer.java:99)
    at my.padam.solr.SolrJQueryTest.testQuery(SolrJQueryTest.java:134)
    at my.padam.solr.SolrJQueryTest.main (SolrJQueryTest.java:165)
-- 
Thanks
George L

Re: MoreLikeThis throwing NPE

Posted by George L <ge...@gmail.com>.
Looks like the query field has to be stored for MLT.

It was failing when i had both query field and similarity fields unstored
before.

MLT is working fine with this configuration

query_field - indexed and stored
similarity_field - indexed, unstored and termvectors stored.

But why should the query field be stored?

It will be nice if http://wiki.apache.org/solr/FieldOptionsByUseCase is
updated.

-- 
Thanks
George L


On 9/9/07, Ryan McKinley <ry...@gmail.com> wrote:
>
> George L wrote:
> > I have been trying the MLT Query using EmbeddedSolr and SolrJ clients,
> which
> > is resulting in NPE.
> >
>
> Do you get the same error without solrj?
>
> Can you run the same query with:
>    http://localhost:8987/solr/select?q=id:100001&mlt=true....
>
> (just to make sure we only need to look at the MLT code)
>
> ryan
>

Re: MoreLikeThis throwing NPE

Posted by Ryan McKinley <ry...@gmail.com>.
George L wrote:
> I have been trying the MLT Query using EmbeddedSolr and SolrJ clients, which
> is resulting in NPE.
> 

Do you get the same error without solrj?

Can you run the same query with:
   http://localhost:8987/solr/select?q=id:100001&mlt=true....

(just to make sure we only need to look at the MLT code)

ryan

Re: MoreLikeThis throwing NPE

Posted by Ryan McKinley <ry...@gmail.com>.
> 
> Can somebody help me please, i have already spent a whole saturday night
> with the trunk code ;-(
> 

Also, do you get the same error with an empty database?