lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ryan McKinley <>
Subject Re: passing params into SOLR
Date Thu, 06 Mar 2008 01:12:06 GMT
Paul Treszczotko wrote:
> Hi all,
> I'm using solrJ to build a wrapper for ColdFusion (scripting language such as PHP). What's
the best practice for passing search parameters into solr from a web app? What are the shortcomings
of each approach?  Currently, I'm explicitly setting the params with solrQuery.setParam("name","value")
and solrQuery.addFacetField("facet","value") etc.
> How would I go about passing a valid query string into solr? Do I need to 'decompose'
it into parameters and then set them with setParam()s, or is there a method that will take
the entire URL and execute it as is?

I'm not sure I follow what the problem is.  The solrj API takes a 
SolrParams argument.  SolrQuery is a subclass of SolrParms that has 
helper functions to set the standard params.  For example:

   public void setQuery(String query) {
     this.set(CommonParams.Q, query);

   public String getQuery() {
     return this.get(CommonParams.Q);

So it is exactly equivalent to use:
   solrQuery.setQuery( "hello" );
   solrQuery.set( "q", "hello" )

though stylistically the former may be nicer and easier to maintain.


Also, when you post a message to the group, start a new message rather 
then replying to another on -- it makes things hard to follow.


> pt
> ???0?
> Paul Treszczotko
> Architect, Client Systems
> 11720 Plaza America Drive, Suite 1200 Reston, Virginia 20190
> Direct: 703-707-3524; Fax 703-707-6201
> This email and any files transmitted with it are confidential and are intended solely
for the use of the individual or entity to which they are addressed. If you are not the intended
recipient or the person responsible for delivering the email to the intended recipient, be
advised that you have received this email and any such files in error and that any use, dissemination,
forwarding, printing or copying of this email and/or any such files is strictly prohibited.
If you have received this email in error please immediately notify and
destroy the original message and any such files.

View raw message