RE: Same query fails in SolrJ, but works in the browser.

2015-08-04 Thread Mark Horninger
I just found that, too.  It's not the exact same query if you misspell your 
parameter.   Oh, the benefits of a second look at things.

Thanks Mikhail.

-Original Message-
From: Mikhail Khludnev [mailto:mkhlud...@griddynamics.com] 
Sent: Tuesday, August 04, 2015 9:37 AM
To: solr-user 
Subject: Re: Same query fails in SolrJ, but works in the browser.

On Tue, Aug 4, 2015 at 4:24 PM, Mark Horninger < 
mhornin...@grayhairsoftware.com> wrote:

> 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://
> :8983/solr//select?q=Fred&defType=dismax&sort=date1
> %20desc&qf=Line1^2%20Line2%20Line3%20Line4%20Line5%20Line6%20Line7^2%2
> 0Line8^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://:8983/solr/");
>   SolrQuery parms = new SolrQuery();
>   parms.set("q", q);
>   parms.set("defTpe", defType);
>
"defTpe" ???


>   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>
>
>


--
Sincerely yours
Mikhail Khludnev
Principal Engineer,
Grid Dynamics

<http://www.griddynamics.com>



Re: Same query fails in SolrJ, but works in the browser.

2015-08-04 Thread Mikhail Khludnev
On Tue, Aug 4, 2015 at 4:24 PM, Mark Horninger <
mhornin...@grayhairsoftware.com> wrote:

> 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://
> :8983/solr//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://:8983/solr/");
>   SolrQuery parms = new SolrQuery();
>   parms.set("q", q);
>   parms.set("defTpe", defType);
>
"defTpe" ???


>   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 
>
>


-- 
Sincerely yours
Mikhail Khludnev
Principal Engineer,
Grid Dynamics





Re: Same query fails in SolrJ, but works in the browser.

2015-08-04 Thread Erik Hatcher
What does Solr log in the 400 response situation?  It’d be good to compare the 
logging of both browser and SolrJ requests - something is different.

—
Erik Hatcher, Senior Solutions Architect
http://www.lucidworks.com 




> On Aug 4, 2015, at 9:24 AM, Mark Horninger  
> wrote:
> 
> 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://:8983/solr//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://:8983/solr/");
>  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 
> 



Same query fails in SolrJ, but works in the browser.

2015-08-04 Thread Mark Horninger
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://:8983/solr//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://:8983/solr/");
  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