lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ahmet Arslan <>
Subject Re: Searching for document by id in a sharded environment
Date Mon, 09 Dec 2013 12:21:21 GMT
Hi Daniel,

TermQueryParser comes handy when you don't want to escape.

q = {!term f=id}156a05d1-8ebe-4f3c-b548-60a84d167a16!643fd57c-c65e-4929-bc0e-029aa4f07475

On Monday, December 9, 2013 2:14 PM, Daniel Bryant <> wrote:

I'm in the process of migrating an application that queries Solr to use 
a new sharded SolrCloud, and as part of this I'm adding the shard key to 
the document id when we index documents (as we're using grouping and we 
need to ensure that grouped documents end up on the same shard) e.g.


I'm having a problem with my application when searching by id with SolrJ 
CloudSolrServer - the exclamation point is misinterpreted as a boolean 
negation, and the matching document is not returned in the search results.

I just wanted to check if the only way to make this work would be to 
escape the exclamation point (i.e. prefix with a slash, or enclose the 
id within quotes). We're keen to avoid this, as this will require lots 
of modifications throughout the code on a series of applications that 
interact with Solr.

If anyone has any better suggestions on how to achieve this it would be 
very much appreciated!

Best wishes,


*Daniel Bryant  |  Software Development Consultant  | 
<>* <>  |  +44 
(0) 7799406399  |  Twitter: @taidevcouk <>

View raw message