Sorting failing in latest master


(Samuel Doyle) #1

I am now seeing failures in my search when sorting. I have not made any
changes to my code or data which had worked previously.

Query Failed [Failed to execute main query]]; nested: IOException[Can't sort
on string types with more than one value per doc, or more than one token per
field]; ]

is this something new?

Thanks


(Shay Banon) #2

Are you sorting on an analyzed field or a field that has several values
within a document?

-shay.banon

On Thu, Jul 15, 2010 at 2:18 AM, Samuel Doyle samueldoyle@gmail.com wrote:

I am now seeing failures in my search when sorting. I have not made any
changes to my code or data which had worked previously.

Query Failed [Failed to execute main query]]; nested: IOException[Can't
sort on string types with more than one value per doc, or more than one
token per field]; ]

is this something new?

Thanks


(Samuel Doyle) #3

It is actually a lastname field and it is analyzed although it probably
should not be.
It did work before however.

On Wed, Jul 14, 2010 at 4:20 PM, Shay Banon shay.banon@elasticsearch.comwrote:

Are you sorting on an analyzed field or a field that has several values
within a document?

-shay.banon

On Thu, Jul 15, 2010 at 2:18 AM, Samuel Doyle samueldoyle@gmail.comwrote:

I am now seeing failures in my search when sorting. I have not made any
changes to my code or data which had worked previously.

Query Failed [Failed to execute main query]]; nested: IOException[Can't
sort on string types with more than one value per doc, or more than one
token per field]; ]

is this something new?

Thanks


(Shay Banon) #4

It might have worked before (it actually depends on the Lucene version when
it worked), but, it does not make sense to sort on a field that is analyzed.
So, either use a multi_field mapping, and add another mapping for last_name
that is not analyzed (and name it something like lastNameSortable), or have
the actual last name not analyzed.

-shay.banon

On Thu, Jul 15, 2010 at 2:26 AM, Samuel Doyle samueldoyle@gmail.com wrote:

It is actually a lastname field and it is analyzed although it probably
should not be.
It did work before however.

On Wed, Jul 14, 2010 at 4:20 PM, Shay Banon shay.banon@elasticsearch.comwrote:

Are you sorting on an analyzed field or a field that has several values
within a document?

-shay.banon

On Thu, Jul 15, 2010 at 2:18 AM, Samuel Doyle samueldoyle@gmail.comwrote:

I am now seeing failures in my search when sorting. I have not made any
changes to my code or data which had worked previously.

Query Failed [Failed to execute main query]]; nested: IOException[Can't
sort on string types with more than one value per doc, or more than one
token per field]; ]

is this something new?

Thanks


(Samuel Doyle) #5

Cool, thanks!

S.D.

On Wed, Jul 14, 2010 at 4:34 PM, Shay Banon shay.banon@elasticsearch.comwrote:

It might have worked before (it actually depends on the Lucene version when
it worked), but, it does not make sense to sort on a field that is analyzed.
So, either use a multi_field mapping, and add another mapping for last_name
that is not analyzed (and name it something like lastNameSortable), or have
the actual last name not analyzed.

-shay.banon

On Thu, Jul 15, 2010 at 2:26 AM, Samuel Doyle samueldoyle@gmail.comwrote:

It is actually a lastname field and it is analyzed although it probably
should not be.
It did work before however.

On Wed, Jul 14, 2010 at 4:20 PM, Shay Banon <shay.banon@elasticsearch.com

wrote:

Are you sorting on an analyzed field or a field that has several values
within a document?

-shay.banon

On Thu, Jul 15, 2010 at 2:18 AM, Samuel Doyle samueldoyle@gmail.comwrote:

I am now seeing failures in my search when sorting. I have not made any
changes to my code or data which had worked previously.

Query Failed [Failed to execute main query]]; nested: IOException[Can't
sort on string types with more than one value per doc, or more than one
token per field]; ]

is this something new?

Thanks


(Shay Banon) #6

Just to explain a bit more, what you ended up with when sorting on a field
that is analyzed (on recent Lucene version, before it was throwing a similar
exception) is just sorting on the first term that got tokenized from the
field. Many times its not really what you want.

I have reimplemented sorting in 0.9 (so it uses the same data facets use,
and script fields) for better memory management, and currently its easier
for me to simply throw an exception in this case. I might revisit this
decision later on and allow to sort on fields that have multiple terms, but
it will still only use the first term, which, as mentioned above, does not
make sense most of the times.

-shay.banon

On Thu, Jul 15, 2010 at 2:35 AM, Samuel Doyle samueldoyle@gmail.com wrote:

Cool, thanks!

S.D.

On Wed, Jul 14, 2010 at 4:34 PM, Shay Banon shay.banon@elasticsearch.comwrote:

It might have worked before (it actually depends on the Lucene version
when it worked), but, it does not make sense to sort on a field that is
analyzed. So, either use a multi_field mapping, and add another mapping for
last_name that is not analyzed (and name it something like
lastNameSortable), or have the actual last name not analyzed.

-shay.banon

On Thu, Jul 15, 2010 at 2:26 AM, Samuel Doyle samueldoyle@gmail.comwrote:

It is actually a lastname field and it is analyzed although it probably
should not be.
It did work before however.

On Wed, Jul 14, 2010 at 4:20 PM, Shay Banon <
shay.banon@elasticsearch.com> wrote:

Are you sorting on an analyzed field or a field that has several values
within a document?

-shay.banon

On Thu, Jul 15, 2010 at 2:18 AM, Samuel Doyle samueldoyle@gmail.comwrote:

I am now seeing failures in my search when sorting. I have not made any
changes to my code or data which had worked previously.

Query Failed [Failed to execute main query]]; nested: IOException[Can't
sort on string types with more than one value per doc, or more than one
token per field]; ]

is this something new?

Thanks


(system) #7