2

I'm pretty new to Solr but something is not working as expected...

I'm searching for documents where the name = 'the*'. This query is working since I'm getting a numFound > 0. But the docs in the response are empty even though I have set &fl=*

I would like to display all the fields available for the documents in the response. (I also tried with &fl=name but it doesn't change anything.

My query:

http://localhost:8983/solr/collection1/select q=name%3Athe*&rows=5&fl=*&wt=json&indent=true

The response:

{
  "responseHeader": {
    "status": 0,
    "QTime": 0,
    "params": {
      "q": "name:the*",
      "indent": "true",
      "fl": "*",
      "rows": "5",
      "wt": "json",
      "_": "1409803190693"
    }
  },
  "response": {
    "numFound": 257052,
    "start": 0,
    "docs": [
      {},
      {},
      {},
      {},
      {}
    ]
  }
}
Romain
  • 1,511
  • 1
  • 10
  • 13
  • 3
    Would need to see your field definitions to know, but for a shot in the dark: You may not be storing any fields. A field with `indexed=true` can be searched, a field with `stored=true` can be retrieved. See [Solr's common field options](http://wiki.apache.org/solr/SchemaXml#Common_field_options). – femtoRgon Sep 04 '14 at 06:26
  • yes, looks like none of the field is stored. – sidgate Sep 04 '14 at 15:15
  • @femtoRgon Thank you for your help, but I checked my schema.xml and I found this for the name field: ``. Can this issue come from when the index was made? I didn't create the index so maybe the fields weren't stored and that's why I can't access it now? – Romain Sep 04 '14 at 18:32
  • 1
    @Romain - It would definitely take affect only when the index was created. To fix that, the index would need to be recreated with the correct fields being stored. – femtoRgon Sep 04 '14 at 20:32
  • @femtoRgon - I understand now, thanks for the explanation. Now I'm wondering what can be the purpose of such an index (with 0 field stored?), I'm not sure to understand the point of this since nothing can be displayed. Thanks! – Romain Sep 04 '14 at 20:59

1 Answers1

1

My problem was that when the index was created the fields were not stored in the schema.xml file so I couldn't access them after (even with the stored attribut set to true).

Romain
  • 1,511
  • 1
  • 10
  • 13