John Eipe
John Eipe

Reputation: 11228

Why does SOLRJ fail with undefined field error

I'm using SOLRJ library.

query.setQuery("content_raw:born");
query.setParam("df", "content");
query.setParam("hl", "true");
QueryResponse solrResponse = server.query(query);

And I get undefined field content_raw error.

But when I hit the URL that get's generated (I got it from the logs) in a browser, it works.

http://localhost:8983/solr/testCollection/select?
q=content_raw%3Aborn
&df=content
&hl=true

Any Idea on why this strange behaviour.

My schema.xml

<field name="content" type="text_general" indexed="false" stored="true"
        multiValued="true" />
<field name="content_raw" type="text_general" indexed="true" stored="false"
        multiValued="true" />
<copyField source="content" dest="content_raw" />

Upvotes: 0

Views: 1262

Answers (1)

Swaraj
Swaraj

Reputation: 589

It might be the problem that your solrserver url used in creating server instance might be wrong as it uses collection1 by default. You have to specify solr-core in server as testCollection. After that it will work fine for sure.

Upvotes: 1

Related Questions