What is the field type of if field? Is it string?

What happens when you do :

&q={!raw f=id}-3f66fdfb1ef5f8719f65a7403e93cc9d

query.setQuery("{!raw f=id}-3f66fdfb1ef5f8719f65a7403e93cc9d");



--- On Sun, 2/20/11, Paul Tomblin <ptomb...@xcski.com> wrote:

> From: Paul Tomblin <ptomb...@xcski.com>
> Subject: How to get a field that starts with a minus?
> To: solr-user@lucene.apache.org
> Date: Sunday, February 20, 2011, 5:15 PM
> I have a field in my database, "id",
> which is the unique key.  The id
> is generated as an MD5 hash of some of the other data in
> the record,
> and unfortunately the way I converted it to hex meant that
> sometimes I
> get a negative value.  I'm having a real hard time
> figuring out the
> right combination of quotes and escapes so I can actually
> query these
> things using SolrJ.  On the Solr web interface, I can
> just do put in
> id:"-3f66fdfb1ef5f8719f65a7403e93cc9d"
> which results in a url like:
> http://localhost:8080/solrChunk/nutch/select/?q=id:%22-3f66fdfb1ef5f8719f65a7403e93cc9d%22&version=2.2&start=0&rows=10&indent=on
> but when I try that using SolrJ
> 
>         SolrQuery query = new
> SolrQuery();
>         query.setQuery(key + ":" +
> value);
>         query.setRows(NUM_AT_A_TIME);
> 
>             int start = 0;
>             while (true)
>             {
>                
> query.setStart(start);
>                
> QueryResponse resp = solrChunkServer.query(query);
>                
> SolrDocumentList docs = resp.getResults();
>                
> LOG.debug("got " + docs.getNumFound() + " documents
> (or " + docs.size() + " if you prefer)");
>                 if
> (docs.size() == 0)
>                
>     break;
> 
>                 for
> (SolrDocument doc : docs)
>                 {
>                
>     retCode.add(doc);
>                 }
>                 if
> (docs.size() < NUM_AT_A_TIME)
>                
>     break;
> 
>                
> start += NUM_AT_A_TIME;
>             }
> 
> I call that using key = "id" and value =
> "-3f66fdfb1ef5f8719f65a7403e93cc9d" and I get an
> exception.  If I
> change value to "\"-3f66fdfb1ef5f8719f65a7403e93cc9d\"", I
> get no
> results.  If I change value to
> "\-3f66fdfb1ef5f8719f65a7403e93cc9d", I
> get no results.  If I change value to
> "\"\-3f66fdfb1ef5f8719f65a7403e93cc9d\"", I get no
> results.
> 
> If I had hair, I'd be tearing it out right now.
> 
> -- 
> http://www.linkedin.com/in/paultomblin
> http://careers.stackoverflow.com/ptomblin
> 



Reply via email to