lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Horninger <mhornin...@grayhairsoftware.com>
Subject Same query fails in SolrJ, but works in the browser.
Date Tue, 04 Aug 2015 13:24:26 GMT
Hi Solr Users,

I am running into a problem where a more complex dismax query I am trying to run works with
no problem in the browser.  The query is as follows:
http://<solr-server>:8983/solr/<core>/select?q=Fred&defType=dismax&sort=date1%20desc&qf=Line1^2%20Line2%20Line3%20Line4%20Line5%20Line6%20Line7^2%20Line8^2%20Line9%20Line10^1

Like I said, I can run this query without problem in the browser, however there is a problem
trying to run the exact same query within SolrJ, I get a 400 error back, with the text "undefined
field name"

The code to generate the query is as follows:
q: Fred
defType: dismax
sort: date1 desc
qf: Line1^2 Line2 Line3 Line4 Line5 Line6 Line7^2 Line8^2 Line9 Line10^1

String result = null;
            SolrClient client = null;
            QueryResponse response = null;
            try {
                  client = new HttpSolrClient(
                              "http://<solr-server>:8983/solr/<core>");
                  SolrQuery parms = new SolrQuery();
                  parms.set("q", q);
                  parms.set("defTpe", defType);
                  parms.set("sort", sort);
                  parms.set("qf", qf);
                  parms.set("rows", rows);
                  response = client.query(parms);
            } catch (SolrServerException e) {
                  e.printStackTrace();
            } catch (IOException e) {
                  e.printStackTrace();
            } finally {
                  if (client != null) {
                        try {
                              client.close();
                        } catch (IOException e) {
                              e.printStackTrace();
                        }
                  }
            }
            if(response != null) {
                  result = response.toString();
            }
            return result;
      }

For whatever reason, this is not working.  If anyone could shed some light on the issue I
would be extremely grateful.

Thanks,

-Mark
[GrayHair]
GHS Confidentiality Notice

This e-mail message, including any attachments, is for the sole use of the intended recipient(s)
and may contain confidential and privileged information. Any unauthorized review, use, disclosure
or distribution of this information is prohibited, and may be punishable by law. If this was
sent to you in error, please notify the sender by reply e-mail and destroy all copies of the
original message.

GrayHair Software <http://www.grayhairSoftware.com>


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message