Or just use the internal document ID: fl=*,[docid]

Granted, the docID may change if a segment merge occurs and earlier documents have been deleted, but it may be sufficient for your purposes.

-- Jack Krupansky

-----Original Message----- From: Upayavira
Sent: Friday, January 03, 2014 5:58 PM
To: solr-user@lucene.apache.org
Subject: Re: how to include result ordinal in response

On Fri, Jan 3, 2014, at 10:00 PM, Peter Keegan wrote:
Is there a simple way to output the result number (ordinal) with each
returned document using the 'fl' parameter? This would be useful when
visually comparing the results from 2 queries.

I'm not aware of a simple way.

If you're competent in Java, this could be a neat new DocTransformer
component. You'd say:

fl=*,[position]

and you'd get a new field in your search results.

Cruder ways would be to use XSLT to add it to an XML output, or a
velocity template, but the DocTransformer approach would create
something that could be of ongoing use.

Upayavira

Reply via email to