On Mon, Apr 4, 2016 at 2:24 PM, Chris Hostetter
<hossman_luc...@fucit.org> wrote:
>
> : You can sort like this (I believe that _version_ is the internal id/index
> : number for the document, but you might want to verify)
>
> that is not true, and i strongly advise you not to try to sort on the
> _version_ field ... for some queries/testing it may deceptively *look*
> like it's sorting by the order the documents are added, but it will not
> actaully sort in any useful way -- two documents added in sequence A, B
> may have version values that are not in ascending sequence (depending on
> the hash bucket their uniqueKeys fall in for routing purposes) so sorting
> on that field will not give you any sort of meaningful order

Not sure I understand... _version_ is time based and hence will give
roughly the same accuracy as something like
TimestampUpdateProcessorFactory that you recommend below.  Both
methods will not be strictly equivalent to indexed order due to
parallelism / thread scheduling, etc., but will generally be pretty
close.
_version_ has the added benefit of being unique in an index (hence a
sort on _version_ won't resort to a tie-break by unstable
internal-id).

-Yonik


> If you want to sort by "recency" or "date added you need to add a
> date based field to capture this.  see for example the
> TimestampUpdateProcessorFactory...
>
> https://lucene.apache.org/solr/5_5_0/solr-core/org/apache/solr/update/processor/TimestampUpdateProcessorFactory.html
>
>
>
> -Hoss
> http://www.lucidworks.com/

Reply via email to