Hi Juan I tried with the following code first:
final SolrQuery allDocumentsQuery = new SolrQuery(); allDocumentsQuery.setQuery("id:" + myId); allDocumentsQuery.setFields("*"); allDocumentsQuery.setRows(1); QueryResponse response = solr.query(allDocumentsQuery, METHOD.POST); With this, only non-dynamic fields are returned. Then I wrote the following helper method: private Set<String> getDynamicFields() throws SolrServerException, IOException { final LukeRequest luke = new LukeRequest(); luke.setShowSchema(false); final LukeResponse process = luke.process(solr); final Map<String, FieldInfo> fieldInfo = process.getFieldInfo(); final Set<String> dynamicFields = new HashSet<String>(); for (final String key : fieldInfo.keySet()) { if (key.endsWith("_string") || (key.endsWith("_dateTime"))) { dynamicFields.add(key); } } return dynamicFields; } where as _string and _dateTime are the suffixes of my dynamic fields. This one returns really all stored fields of the document: final Set<String> dynamicFields = getDynamicFields(); final SolrQuery allDocumentsQuery = new SolrQuery(); allDocumentsQuery.setQuery("uri:" + myId); allDocumentsQuery.setFields("*"); for (final String df : dynamicFields) { allDocumentsQuery.addField(df); } allDocumentsQuery.setRows(1); QueryResponse response = solr.query(allDocumentsQuery, METHOD.POST); Is there a more elegant way to do this? We are using solrj 3.1.0 and solr 3.1.0. Regards Michael -- Michael Szalay Senior Software Engineer basis06 AG, Birkenweg 61, CH-3013 Bern - Fon +41 31 311 32 22 http://www.basis06.ch - source of smart business ----- Ursprüngliche Mail ----- Von: "Juan Grande" <juan.gra...@gmail.com> An: solr-user@lucene.apache.org Gesendet: Montag, 29. August 2011 18:19:05 Betreff: Re: How to list all dynamic fields of a document using solrj? Hi Michael, It's supposed to work. Can we see a snippet of the code you're using to retrieve the fields? *Juan* On Mon, Aug 29, 2011 at 8:33 AM, Michael Szalay <michael.sza...@basis06.ch>wrote: > Hi all > > how can I list all dynamic fields and their values of a document using > solrj? > The dynamic fields are never returned when I use setFields(*). > > Thanks > > Michael > > -- > Michael Szalay > Senior Software Engineer > > basis06 AG, Birkenweg 61, CH-3013 Bern - Fon +41 31 311 32 22 > http://www.basis06.ch - source of smart business > >