lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jack Krupansky" <>
Subject Re: Is Solr always trimming result objects ?
Date Mon, 04 Feb 2013 21:24:53 GMT
Seems to work for me, at least at the Solr HTTP level. I just did a quick 
test using the stock Solr 4.0 example.

I added a couple of mini-docs that had spaces in their ids, both leading and 

curl http://localhost:8983/solr/update?commit=true -H 
'Content-type:application/csv' -d '
abc-3  ,csv-sku-3
  abc-4  ,csv-sku-4'

Then I queried them:

curl "http://localhost:8983/solr/select/?q=id:*abc-*&indent=true"


<result name="response" numFound="4" start="0">
    <str name="id">abc-1</str>
    <str name="sku">csv-sku-1</str>
    <long name="_version_">1426076902160859136</long></doc>
    <str name="id">  abc-2</str>
    <str name="sku">csv-sku-2</str>
    <long name="_version_">1426076902167150592</long></doc>
    <str name="id">abc-3  </str>
    <str name="sku">csv-sku-3</str>
    <long name="_version_">1426076902167150593</long></doc>
    <str name="id">  abc-4  </str>
    <str name="sku">csv-sku-4</str>
    <long name="_version_">1426076902168199168</long></doc>

All the spaces are there.

I didn't try a SolrJ query.

-- Jack Krupansky
-----Original Message----- 
From: Marc Hermann
Sent: Monday, February 04, 2013 11:40 AM
Subject: Is Solr always trimming result objects ?

Hi everyone,

i am new to SOLR and I have experienced a strange behavior:

I have defined a field "name" of type "string". This field contains values
with trailing spaces such as " John".
This is intended and the space needs to "survive".

The space is in the index as I can see when using Luke.

But when I am retrieving documents from the index using :

    final CommonsHttpSolrServer sorlServer =
    final SolrQuery solrQuery = query.getSolrQuery();
    final QueryResponse response = sorlServer.query(solrQuery);

    final Result result = new Result();
    final SolrDocumentList documents = response.getResults();

... I donĀ“t get the spaces ... as if all values always get a trim() before
they are returned.

Any suggestions ?
Is this a standard behavior ?

Best regards,

M. Hermann 

View raw message