lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jack Krupansky" <>
Subject Re: Setting "df" (default field) from solrj?
Date Wed, 08 Aug 2012 15:04:21 GMT
You should simply set the default value for the "df" request parameter in 
your Solr request handlers in solrconfig.xml. It is set to "text" out of the 
box, but you can set it to your desired field.

If you still want to set/override "df" from SolrJ anyway, use the 
SolrQuery.setParam method:

solrQuery.setParam("df", "SearchText");

-- Jack Krupansky

-----Original Message----- 
From: homernabble
Sent: Wednesday, August 08, 2012 10:07 AM
Subject: Setting "df" (default field) from solrj?

I see in Solr 4 the defaultSearchField tag in schema.xml has been 
I was looking in the Solrj API and I don't see a method for setting the
default field on a SolrQuery object.

This is basically what the code looks like now (stripped down):
solrQuery =
queryResponse = solrServer.query(solrQuery)

Before Solr 4 this would work fine because defaultSearchField was set in
schema.xml.  Now I need to be able to set it from my solrj call.

Am I missing something, how can I set this for my queries via solrj?

As I'm typing this I realize I can do something like I have below (and this
is fine) but still wondering if there is a dedicated method for setting this

solrQuery.add("df", "SearchText")

View this message in context:
Sent from the Solr - User mailing list archive at 

View raw message