Hi Deniz,

Haven't used geofilt query parser but with solrJ you don't need URL encoding. 
Use solrQuery.set("fq","{!geofilt sfield=store}"); instead.



--- On Thu, 10/25/12, deniz <denizdurmu...@gmail.com> wrote:

> From: deniz <denizdurmu...@gmail.com>
> Subject: org.apache.lucene.queryparser.classic.ParseException - a Bug?
> To: solr-user@lucene.apache.org
> Date: Thursday, October 25, 2012, 7:18 AM
> Hi all,
> 
> I was trying to provide spatial search via solrj client. but
> when i try to
> run it i got 
> 
> 
> org.apache.solr.common.SolrException:
> org.apache.lucene.queryparser.classic.ParseException:
> Expected identifier at
> pos 9 str='{!geofilt+sfield=store}'
> 
> 
> I have tried to do the same search on browser and via URL
> request from java
> and there was no problem with those... but via solrj i keep
> getting the
> error above... 
> 
> below is the code that I have used to reproduce the error 
> 
> 
> 
> import java.io.BufferedReader;
> import java.io.InputStreamReader;
> import java.io.OutputStreamWriter;
> import java.net.URL;
> import java.net.URLConnection;
> 
> import org.apache.solr.client.solrj.SolrQuery;
> import org.apache.solr.client.solrj.impl.HttpSolrServer;
> import org.apache.solr.client.solrj.response.QueryResponse;
> import org.apache.solr.common.SolrDocumentList;
> 
> 
> public class RunMeFast {
>     
>     
>  public static void main(String[] args)
>  {
>      try{
>      HttpSolrServer server = new
> HttpSolrServer("http://localhost:8983/solr/testcore";);
>      SolrQuery solrQuery = new
> SolrQuery();
>     
>     
>      solrQuery.set("q", "*:*");
>      solrQuery.set("d","1000");
>      solrQuery.set("fl","*,_dist_:geodist()");
>      solrQuery.set("sfield","store");
>      solrQuery.set("pt","47,+8");
>      solrQuery.set("fq","{!geofilt+sfield=store}");
> 
>      QueryResponse   response
> = server.query(solrQuery);
>      long totalDocs =
> response.getResults().getNumFound();
>      SolrDocumentList docList =
> response.getResults();
>      System.out.println(docList.toString());
>      }
>      catch(Exception e ){
>    
>      e.printStackTrace();
>      }
>      
>      
>      try
>      {
>          URL url =
> new
> URL("http://localhost:8983/solr/testcore/select?q=*:*&d=1000&fl=*,_dist_:geodist()&sfield=store&pt=47,+8&fq={!geofilt+sfield=store}");
>    
>      URLConnection conn =
> url.openConnection();
>            
> conn.setDoOutput(true);
>            
> OutputStreamWriter wr = new
> OutputStreamWriter(conn.getOutputStream());
>            
> wr.flush();
> 
>             // Get
> the response
>            
> BufferedReader rd = new BufferedReader(new
> InputStreamReader(conn.getInputStream()));
>             String
> line;
>             while
> ((line = rd.readLine()) != null) {
>              
>   System.out.println(line);   
>         }
>            
> wr.close();
>            
> rd.close();
>          
>      }catch(Exception e){
>    
>      e.printStackTrace();
>      }
>      
>  }
>     
> 
> 
> 
> And the output is :
> 
> 
> SOLRJ Call:
> 
> Oct 25, 2012 11:54:24 AM
> org.apache.solr.client.solrj.impl.HttpClientUtil
> createClient
> INFO: Creating new http client,
> config:maxConnections=128&maxConnectionsPerHost=32&followRedirects=false
> org.apache.solr.common.SolrException:
> org.apache.lucene.queryparser.classic.ParseException:
> Expected identifier at
> pos 9 str='{!geofilt+sfield=store}'
>     at
> org.apache.solr.client.solrj.impl.HttpSolrServer.request(HttpSolrServer.java:401)
>     at
> org.apache.solr.client.solrj.impl.HttpSolrServer.request(HttpSolrServer.java:181)
>     at
> org.apache.solr.client.solrj.request.QueryRequest.process(QueryRequest.java:90)
>     at
> org.apache.solr.client.solrj.SolrServer.query(SolrServer.java:301)
>     at RunMeFast.main(RunMeFast.java:29)
> 
> URL Request:
> <?xml version="1.0" encoding="UTF-8"?>
> <response>
> correct doc list
> </response>
> 
> 
> 
> I am using Solr 4.0...
> 
> so is this a bug? or simply a mistake? anyone can help me?
> 
> 
> 
> 
> 
> 
> 
> 
> -----
> Zeki ama calismiyor... Calissa yapar...
> --
> View this message in context: 
> http://lucene.472066.n3.nabble.com/org-apache-lucene-queryparser-classic-ParseException-a-Bug-tp4015763.html
> Sent from the Solr - User mailing list archive at
> Nabble.com.
>

Reply via email to