You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by yriveiro <ya...@gmail.com> on 2015/04/02 12:36:36 UTC

Facet sorting algorithm for index

Hi,

I have an external application that use the output of a facet to join other
dataset using the keys of the facet result.

The facet query use index sort but in some point, my application crash
because the order of the keys "is not correct". If I do an unix sort over
the keys of the result with LC_ALL=C doesn't output the same result.

I identified a case like this:

760d1f833b764591161\"84b20f28242a0
760d1f833b76459116184b20f2

Why the line whit the '\"' is before? This chain of chars is the character "
or is raw and are 2 chars?

In ASCII the " has lower ord than character 8, if \" is " then this sort
makes sense ...

My question here is how index sort works and how I can replicate it in C++





-----
Best regards
--
View this message in context: http://lucene.472066.n3.nabble.com/Facet-sorting-algorithm-for-index-tp4197174.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Facet sorting algorithm for index

Posted by Yonik Seeley <ys...@gmail.com>.
On Thu, Apr 2, 2015 at 9:44 AM, Yago Riveiro <ya...@gmail.com> wrote:
> Where can I found the source code used in index sorting? I need to ensure that the external data has the same sorting that the facet result.

If you step over the indexed terms of a field you get them in sorted
order (hence for a single node, the sorting is done at indexing time).
Lucene index order for text will essentially be unicode code point order.

-Yonik

Re: Facet sorting algorithm for index

Posted by Yago Riveiro <ya...@gmail.com>.
The result is a custom responseWriter, I found a bug in my code that append de \ to “.


The JSON response shows the data without the \.




Where can I found the source code used in index sorting? I need to ensure that the external data has the same sorting that the facet result.


—
/Yago Riveiro

On Thu, Apr 2, 2015 at 12:26 PM, Yonik Seeley <ys...@gmail.com> wrote:

> On Thu, Apr 2, 2015 at 6:36 AM, yriveiro <ya...@gmail.com> wrote:
>> Hi,
>>
>> I have an external application that use the output of a facet to join other
>> dataset using the keys of the facet result.
>>
>> The facet query use index sort but in some point, my application crash
>> because the order of the keys "is not correct". If I do an unix sort over
>> the keys of the result with LC_ALL=C doesn't output the same result.
>>
>> I identified a case like this:
>>
>> 760d1f833b764591161\"84b20f28242a0
>> 760d1f833b76459116184b20f2
>>
>> Why the line whit the '\"' is before? This chain of chars is the character "
>> or is raw and are 2 chars?
>>
>> In ASCII the " has lower ord than character 8, if \" is " then this sort
>> makes sense ...
> How are you viewing the results?  If it's JSON, then yes the backslash
> double quote would mean that there is just a literal double quote in
> the string.
> -Yonik

Re: Facet sorting algorithm for index

Posted by Yonik Seeley <ys...@gmail.com>.
On Thu, Apr 2, 2015 at 6:36 AM, yriveiro <ya...@gmail.com> wrote:
> Hi,
>
> I have an external application that use the output of a facet to join other
> dataset using the keys of the facet result.
>
> The facet query use index sort but in some point, my application crash
> because the order of the keys "is not correct". If I do an unix sort over
> the keys of the result with LC_ALL=C doesn't output the same result.
>
> I identified a case like this:
>
> 760d1f833b764591161\"84b20f28242a0
> 760d1f833b76459116184b20f2
>
> Why the line whit the '\"' is before? This chain of chars is the character "
> or is raw and are 2 chars?
>
> In ASCII the " has lower ord than character 8, if \" is " then this sort
> makes sense ...

How are you viewing the results?  If it's JSON, then yes the backslash
double quote would mean that there is just a literal double quote in
the string.

-Yonik