lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Horninger <mhornin...@grayhairsoftware.com>
Subject RE: Same query fails in SolrJ, but works in the browser.
Date Tue, 04 Aug 2015 13:42:28 GMT
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:mkhludnev@griddynamics.com] 
Sent: Tuesday, August 04, 2015 9:37 AM
To: solr-user <solr-user@lucene.apache.org>
Subject: Re: Same query fails in SolrJ, but works in the browser.

On Tue, Aug 4, 2015 at 4:24 PM, Mark Horninger < mhorninger@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://
> <solr-server>:8983/solr/<core>/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://<solr-server>:8983/solr/<core>");
>                   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>
<mkhludnev@griddynamics.com>
Mime
View raw message