Skip to content

Improve sorting error messages #62

Closed
@payammeyer

Description

When a field has not been indexed as sortable but is being sorted on, the following exception is thrown:

java.lang.IllegalStateException: unexpected docvalues type NONE for field 'titleText' (expected one of [SORTED, SORTED_SET]). Use UninvertingReader or index with docvalues.
    at org.apache.lucene.index.DocValues.checkField(DocValues.java:208)
    at org.apache.lucene.index.DocValues.getSortedSet(DocValues.java:306)
    at org.apache.lucene.search.SortedSetSortField$1.getSortedDocValues(SortedSetSortField.java:125)
    at org.apache.lucene.search.FieldComparator$TermOrdValComparator.getLeafComparator(FieldComparator.java:767)
    at org.apache.lucene.search.FieldValueHitQueue.getComparators(FieldValueHitQueue.java:183)
    at org.apache.lucene.search.TopFieldCollector$SimpleFieldCollector.getLeafCollector(TopFieldCollector.java:164)
    at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:812)
    at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:535)
    at org.lumongo.server.index.LumongoSegment.querySegment(LumongoSegment.java:352)
    at org.lumongo.server.index.LumongoIndex.lambda$queryInternal$10(LumongoIndex.java:866)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)

Improve the message to tell the user the field is not sortable.

When a field doesn't exist, the following exception is thrown:

java.lang.RuntimeException: Unsupported analyzer <null> for sort field <blah>
    at org.lumongo.server.search.QueryCombiner.lambda$getQueryResponse$21(QueryCombiner.java:375)
    at java.util.TimSort.countRunAndMakeAscending(TimSort.java:355)
    at java.util.TimSort.sort(TimSort.java:220)
    at java.util.Arrays.sort(Arrays.java:1512)
    at java.util.ArrayList.sort(ArrayList.java:1454)
    at java.util.Collections.sort(Collections.java:175)
    at org.lumongo.server.search.QueryCombiner.getQueryResponse(QueryCombiner.java:393)
    at org.lumongo.server.index.LumongoIndexManager.query(LumongoIndexManager.java:708)
    at org.lumongo.server.connection.ExternalServiceHandler.query(ExternalServiceHandler.java:129)
    at org.lumongo.cluster.message.Lumongo$ExternalService.callMethod(Lumongo.java:50280)
    at com.googlecode.protobuf.pro.duplex.execute.NonInterruptingThreadPoolCallExecutor$CallRunner.run(NonInterruptingThreadPoolCallExecutor.java:213)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)

Improve the message to say the field doesn't exist.

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions