Repository navigation
Sort in memory the orders by keys which the index backend can't sort - #5121
Merged
Merged
Conversation
Fixes JanusGraph#5120 A mixed index which held the key of a graph query's order was given the order whatever the key's mapping, but none of JanusGraph's index backends sorts by the strings of a key of TEXT mapping, which is the default for strings, as the index holds the words of each string. So an order by such a key, such as g.V().has('kind', 'p').order().by('title'), also next to a key which the index can sort by, failed with "Could not call index" on Lucene, which keeps no doc values of the field, and on Elasticsearch and OpenSearch, which don't sort by a text field, and Solr returned the elements in the order of the least word of each string. Elasticsearch and OpenSearch failed in the same way on a STRING key with a custom string analyzer, and on such a TEXTSTRING key, whose whole strings are then a text field too, and Lucene on a UUID key, by which it doesn't sort. IndexInformation, and so IndexProvider, now tells by supportsOrdering(KeyInformation) whether the index can sort by a key, true by default, so that an index provider which doesn't implement it is given every order, as before. Lucene can by numbers, dates, booleans and the strings of a STRING or TEXTSTRING key, of which it keeps doc values, Elasticsearch by numbers, dates, booleans, UUIDs and the strings of a STRING or TEXTSTRING key without a custom string analyzer, which it maps to a keyword, and Solr by numbers, dates, booleans, UUIDs and every string key but a TEXT one, which is of a text type. IndexSelectionUtil.indexCoversOrder asks it for each key of the order, so that IndexSerializer gives the index no order by a key which the backend can't sort by, and the index selection strategies don't take the index to sort the results. Where a custom strategy still does, as one which decides by the deprecated indexCoversOrder, the index's query has no order, and GraphCentricQueryBuilder sorts the results already. JanusGraph sorts these orders itself, reading every match first, as any order which no index covers. Signed-off-by: Oleksandr Porunov <alexandr.porunov@gmail.com> Co-authored-by: Oleksandr Porunov <alexandr.porunov@gmail.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
🟢 Approval recommended
The capability checks reuse the existing sorting fallback, preserve provider compatibility, and have focused regression coverage with no unresolved blocking findings.
No open issues 🎉
What changed in this PR
Fixes #5120 by using JanusGraph’s existing in-memory sorting when a mixed-index backend cannot correctly order a property’s whole values. Supported orders remain delegated to the backend.
Changes:
- Adds a backward-compatible ordering capability API, backend implementations, and provider-wrapper delegation.
- Checks every order key before delegating sorting, with regression tests for text mappings, analyzers, UUIDs, and custom index selection.
- Documents fallback behavior, memory costs, and mapping choices for backend sorting.
| File | Description |
|---|---|
| janusgraph-solr/src/test/java/org/janusgraph/diskstorage/solr/SolrIndexTest.java | Tests Solr ordering capabilities. |
| janusgraph-solr/src/main/java/org/janusgraph/diskstorage/solr/SolrIndex.java | Declares sortable Solr mappings and types. |
| janusgraph-lucene/src/test/java/org/janusgraph/diskstorage/lucene/LuceneIndexTest.java | Tests Lucene ordering capabilities. |
| janusgraph-lucene/src/test/java/org/janusgraph/diskstorage/lucene/BerkeleyLuceneTest.java | Removes the UUID ordering test exclusion. |
| janusgraph-lucene/src/main/java/org/janusgraph/diskstorage/lucene/LuceneIndex.java | Declares sortable Lucene mappings and types. |
| janusgraph-es/src/test/java/org/janusgraph/diskstorage/es/ElasticsearchJanusGraphIndexTest.java | Tests fallback sorting for custom string analyzers. |
| janusgraph-es/src/test/java/org/janusgraph/diskstorage/es/ElasticsearchIndexTest.java | Tests Elasticsearch ordering capabilities. |
| janusgraph-es/src/main/java/org/janusgraph/diskstorage/es/ElasticSearchIndex.java | Rejects backend ordering for unsupported text mappings and analyzers. |
| janusgraph-core/src/test/java/org/janusgraph/graphdb/query/index/IndexSelectionUtilTest.java | Tests per-key capability checks and default compatibility. |
| janusgraph-core/src/test/java/org/janusgraph/diskstorage/util/MetricInstrumentedIndexProviderTest.java | Tests capability delegation through the metrics wrapper. |
| janusgraph-core/src/main/java/org/janusgraph/graphdb/query/index/IndexSelectionUtil.java | Requires backend ordering support for every order key. |
| janusgraph-core/src/main/java/org/janusgraph/graphdb/query/graph/GraphCentricQueryBuilder.java | Updates the comment explaining sorting fallback. |
| janusgraph-core/src/main/java/org/janusgraph/graphdb/database/IndexSerializer.java | Exposes provider ordering capabilities to query planning. |
| janusgraph-core/src/main/java/org/janusgraph/diskstorage/util/MetricInstrumentedIndexProvider.java | Forwards ordering capability checks. |
| janusgraph-core/src/main/java/org/janusgraph/diskstorage/indexing/IndexInformation.java | Adds the default ordering capability method. |
| janusgraph-backend-testutils/src/main/java/org/janusgraph/graphdb/TestMockIndexProvider.java | Forwards ordering capabilities in test infrastructure. |
| janusgraph-backend-testutils/src/main/java/org/janusgraph/graphdb/JanusGraphIndexTest.java | Adds cross-backend fallback regressions and enables Lucene UUID coverage. |
| janusgraph-backend-testutils/src/main/java/org/janusgraph/graphdb/DeprecatedOrderCoverageIndexSelectionStrategy.java | Updates documentation of legacy strategy behavior. |
| docs/schema/index-management/index-performance.md | Explains unsupported orders and in-memory fallback. |
| docs/changelog.md | Records behavior changes, sorting costs, and API compatibility. |
Review effort: Balanced
porunov
marked this pull request as ready for review
October 23, 2026 01:50
porunov
added a commit
to porunov/janusgraph
that referenced
this pull request
Oct 23, 2026
Fixes JanusGraph#5124 Since JanusGraph#5108, a traversal's order().by(key) requires a value of the key, so g.V().order().by("name").limit(10) returns what g.V().has("name").order().by("name").limit(10) returns. The second reads the mixed index which holds name with an exists query, sorted by the index, and stops after the first hits. The first has no condition which an index answers, so it read every vertex and sorted them in memory, which fails with a QueryException from a million vertices on, and which query.force-index refused as a full scan. So did g.V().hasLabel("person").order().by("name").limit(10) with an index of the persons, and an order of edges by a key of an edge mixed index. The presence of the order keys joined the query's condition only after the index selection strategy had chosen the indexes for the other conditions, so that it would not add a mixed index next to one which answers them, which a joint query reads whole. Where the strategy chooses no index for the query's own conditions, it now chooses again for those conditions together with the presence of a value of each order key, among the mixed indexes of the result type which may answer them, as its own candidates, and which sort the elements by the query's order: which hold every order key, which their backend sorts by as JanusGraph orders its values, a key of several values included (IndexSelectionUtil.indexCoversOrder, which asks each backend since JanusGraph#5121), and none of them with custom parameters, which Elasticsearch takes into its mapping, so that they may keep it from sorting by the key. The brute-force strategy, which the default one takes up to query.index-select-threshold candidates, weighs an index which holds a key as a text, which no backend sorts by, as one which holds it as a string: left among the candidates, such an index would be taken in place of one which holds the key as a string, by chance, where both answer the query alike. The approximate strategy prefers the one which sorts, by indexCoversOrder. The query takes that choice where it is a single index which covers every condition: a mixed index which holds every order key and answers the query whole, as it answers a has(key). It takes it only where the index is one of the candidates, as nothing keeps a strategy from taking another one. The query is then fitted, and sorted where the index sorts by the query's order, as it does with JanusGraph's strategies (sortedOnlyWhereTheIndexSorts checks it), so that a limit reads only the first hits, and a count() or an aggregation of a key of the index right after the order comes from the index. The strategies decide as for a has(key) whether a mixed index covers such a condition, by the status of the key's field and IndexSerializer.supportsExistsQuery, and take an index restricted to a label only for a query of that label, whose condition the index then covers too. Any other query reads every element as before. One whose index would leave a condition to be checked in memory would read the index in growing batches and look each element up, and a joint query of several indexes reads all but the first whole: every element with a value of their keys. An or() alone still runs each of its branches as a query of its own where no index covers it in the first choice, as none covers it in the second either. A query of JanusGraph's API, which keeps the elements without the key, is unaffected. Signed-off-by: Oleksandr Porunov <alexandr.porunov@gmail.com> Co-authored-by: Oleksandr Porunov <alexandr.porunov@gmail.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
porunov
added a commit
that referenced
this pull request
Oct 24, 2026
Fixes #5124 Since #5108, a traversal's order().by(key) requires a value of the key, so g.V().order().by("name").limit(10) returns what g.V().has("name").order().by("name").limit(10) returns. The second reads the mixed index which holds name with an exists query, sorted by the index, and stops after the first hits. The first has no condition which an index answers, so it read every vertex and sorted them in memory, which fails with a QueryException from a million vertices on, and which query.force-index refused as a full scan. So did g.V().hasLabel("person").order().by("name").limit(10) with an index of the persons, and an order of edges by a key of an edge mixed index. The presence of the order keys joined the query's condition only after the index selection strategy had chosen the indexes for the other conditions, so that it would not add a mixed index next to one which answers them, which a joint query reads whole. Where the strategy chooses no index for the query's own conditions, it now chooses again for those conditions together with the presence of a value of each order key, among the mixed indexes of the result type which may answer them, as its own candidates, and which sort the elements by the query's order: which hold every order key, which their backend sorts by as JanusGraph orders its values, a key of several values included (IndexSelectionUtil.indexCoversOrder, which asks each backend since #5121), and none of them with custom parameters, which Elasticsearch takes into its mapping, so that they may keep it from sorting by the key. The brute-force strategy, which the default one takes up to query.index-select-threshold candidates, weighs an index which holds a key as a text, which no backend sorts by, as one which holds it as a string: left among the candidates, such an index would be taken in place of one which holds the key as a string, by chance, where both answer the query alike. The approximate strategy prefers the one which sorts, by indexCoversOrder. The query takes that choice where it is a single index which covers every condition: a mixed index which holds every order key and answers the query whole, as it answers a has(key). It takes it only where the index is one of the candidates, as nothing keeps a strategy from taking another one. The query is then fitted, and sorted where the index sorts by the query's order, as it does with JanusGraph's strategies (sortedOnlyWhereTheIndexSorts checks it), so that a limit reads only the first hits, and a count() or an aggregation of a key of the index right after the order comes from the index. The strategies decide as for a has(key) whether a mixed index covers such a condition, by the status of the key's field and IndexSerializer.supportsExistsQuery, and take an index restricted to a label only for a query of that label, whose condition the index then covers too. Any other query reads every element as before. One whose index would leave a condition to be checked in memory would read the index in growing batches and look each element up, and a joint query of several indexes reads all but the first whole: every element with a value of their keys. An or() alone still runs each of its branches as a query of its own where no index covers it in the first choice, as none covers it in the second either. A query of JanusGraph's API, which keeps the elements without the key, is unaffected. Signed-off-by: Oleksandr Porunov <alexandr.porunov@gmail.com> Co-authored-by: Oleksandr Porunov <alexandr.porunov@gmail.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #5120
A graph query which a mixed index answers, ordered by a key which the index holds, had the index sort the results, whatever the key's mapping. None of JanusGraph's index backends sorts by the strings of a key of
TEXTmapping, which is the default for strings, as the index holds the words of each string rather than the string. Sog.V().has('kind', 'p').order().by('title'), of such atitle, failed withCould not call indexon Lucene (unexpected docvalues type NONE for field 'title' (expected=SORTED)) and on Elasticsearch and OpenSearch, which don't sort by a text field (Text fields are not optimised for operations that require per-document field data like aggregations and sorting, afterFielddata is disabled on [title]on Elasticsearch), while Solr returned the vertices in the order of the least word of each title, ascending or descending, and a query of JanusGraph's API put those without a title first when ascending. Elasticsearch and OpenSearch failed in the same way on aSTRINGkey with a customstring-analyzer, which JanusGraph maps to a text field, and on aTEXTSTRINGkey with one, whose whole strings, by which the index sorts such a key, are then a text field too. And Lucene failed on a UUID key, by which it doesn't sort (Unsupported order specified on field [uid] with datatype [class java.util.UUID]).JanusGraph now gives the index an order only by the keys which its backend can sort by, and sorts the results of the other orders itself, as it does for any order which no index covers: it reads every match first, and fails with a
QueryExceptionat 1,000,000 of them or more. That holds for the traversals, which fold the order into their query, for the queries of JanusGraph's API, and under a custom index selection strategy which takes the index to sort the results by the deprecatedIndexSelectionUtil.indexCoversOrder(MixedIndexType, OrderList). An order by aTEXTSTRINGkey without a customstring-analyzeris still sorted by the index, by its whole strings.Changes
IndexInformation.supportsOrdering(KeyInformation)(new, true by default), whichIndexProviderextends: whether the index can sort documents by a key with the given information, by its whole values. It sits next tosupports(KeyInformation)andsupports(KeyInformation, JanusGraphPredicate), asIndexSerializerholds the providers asIndexInformation. An index provider which doesn't implement it is given every order, as before. Whether the index can sort by a key of several values is stillIndexFeatures.supportsOrderingListProperty().MetricInstrumentedIndexProvider, which wraps each provider of a graph with metrics enabled, and the tests'TestMockIndexProviderforward it to the provider.IndexSerializer.supportsOrdering(MixedIndexType, ParameterIndexField)(new) asks the index's provider about the field's key information, assupports(MixedIndexType, ParameterIndexField)does.IndexSelectionUtil.indexCoversOrder(MixedIndexType, OrderList, IndexSerializer)takes an index to cover an order only where it can sort by each of the order's keys. The index selection strategies decide by it whether the index they choose first sorts the results, andIndexSerializer.getQuery(MixedIndexType, Condition, OrderList)gives the index's query the order only where it holds. A custom strategy which still takes such an index to sort the results, as one which decides by the deprecatedindexCoversOrder(MixedIndexType, OrderList)does, gets results whichGraphCentricQueryBuilder.sortedOnlyWhereTheIndexSorts(Order by a key of several values as the indexes do #5102) sorts, as the index's query has no order. The javadoc of the deprecated method and the comment ofsortedOnlyWhereTheIndexSortssay so.LuceneIndex.supportsOrdering: numbers, dates and booleans, and the strings of aSTRINGkey or of the dual field of aTEXTSTRINGkey, whatever their analyzers, asgetSortOrdersorts by the doc values whichbuildIndexFieldsadds for them. Not aTEXTorDEFAULTstring key, nor a UUID or geoshape key, for whichgetSortOrderhas no sort type.ElasticSearchIndex.supportsOrdering: numbers, dates, booleans and UUIDs, and aSTRINGorTEXTSTRINGkey without a custom string analyzer, whose field whichaddOrderToQuerysorts by is akeyword. Not aTEXTorDEFAULTstring key, nor aSTRINGkey, or aTEXTSTRINGkey, with a custom string analyzer, whichpushMappingmaps to atextfield (createTextMapping(stringAnalyzer)).SolrIndex.supportsOrdering: numbers, dates, booleans and UUIDs, and every string key but aTEXTorDEFAULTone, whichmapKey2Fieldmaps to*_t, of the example schema'stext_generaltype, which Solr sorts by the least word of each document. ASTRINGkey and the dual field of aTEXTSTRINGkey are of thestringtype, whatever the analyzer, which Solr applies to the values of the queries only.SINGLEcardinality refers to that; its note that a Lucene index fails an order by a UUID key now says that JanusGraph sorts it.Tests
JanusGraphIndexTest.testOrderByATextKeyIsSortedByJanusGraph(every index backend; the mixed index is namedmixed, which the Solr test container creates). Vertices of kindspandqwith atitleofTEXTmapping, anoteof theDEFAULTone and aheading, ofTEXTSTRING, which holds the title, in mixed case and of several words, so that the order of the strings is none of the orders of their words; some have no title or no note. They are written into the graph and into a TinkerGraph, and sixteen traversals return the same from both:titleand bynote, ascending and descending, with limits and a range, by both keys, and acount()after an order;kind, which the index can sort by, and bytitle, either way round;titleandnotenext totextContains()on the same key, which the index answers;heading, alone and next totextContains().They return the same again in a transaction which adds a vertex, gives one a title and takes another one's, and changes a title and a note. A new transaction's profiles show that the index's queries carry no order by
titleornote, also next to the text predicate, none bykindnext totitle, and the order byheading.JanusGraphIndexTest.testResultsWhichAStrategyHoldsSortedByAnIndexWithoutTheOrderAreSortedInMemory(from Order by a key of several values as the indexes do #5102, every index backend) also orders by atitleofTEXTmapping underDeprecatedOrderCoverageIndexSelectionStrategy, which takes the index to sort the results, as its javadoc now says for any key which the index holds:tx.query().orderBy('title', asc)anddesccome in the order of the whole titles, the vertex without a title last.JanusGraphIndexTest.testUUIDsAreOrderedAsTheirStringFormsandtestOrderByUUIDPutsElementsWithoutTheKeyLast(from Compare UUIDs as their string forms, as the indexes and storage do #5088) now run on Lucene too, whosesupportsOrderingByUUID()override, and the method, are gone: JanusGraph sorts these orders on Lucene, in the order of the UUIDs' string forms, with the elements without the key last.ElasticsearchJanusGraphIndexTest.testOrderByAStringKeyWithAStringAnalyzerIsSortedByJanusGraph: acodeofSTRINGmapping and acaptionofTEXTSTRINGmapping, both with thestandardstring analyzer. Five orders by them, ascending and descending, with limits and next totextContains(), return what a TinkerGraph returns, and a new transaction's profiles show that the index's queries carry no order by either, while they carry one bykind, aSTRINGkey without an analyzer.JanusGraphIndexTest'sonBothandresults, and the newindexSortsBy, are protected for it.LuceneIndexTest,ElasticsearchIndexTestandSolrIndexTest:testOrderingSupportcheck each provider's answers for the keys ofIndexProviderTest's mapping (STRINGandTEXTSTRINGkeys with and without custom analyzers,TEXTkeys with and without a text analyzer, aDEFAULTstring key), the number, date and boolean types, UUIDs and geoshapes.IndexSelectionUtilTest.anIndexCoversAnOrderOnlyByTheKeysWhichItsProviderCanSortBy(new): an index whose provider can't sort by aTEXTkey covers an order by aSTRINGkey, but not one by theTEXTkey, alone, after theSTRINGkey or before it, and one whose provider doesn't implementsupportsOrderingcovers each of these orders.MetricInstrumentedIndexProviderTest.supportsOrderingShouldBeTheProvidersAnswer: the wrapper answers as the provider does.Mutations, each breaking one part of the change, are all caught (23, on Lucene, on Elasticsearch 9.5.4 in a container, and on Solr in the JVM):
indexCoversOrderasking the provider about the first key of the order alone, or about the last alone:IndexSelectionUtilTest, for[ASC(kind), ASC(title)]or[ASC(title), ASC(kind)], and the Lucene text order test, at the order bykindandtitle, or bytitleandkind(unexpected docvalues type NONE for field 'title').indexCoversOrdernot asking the provider, orIndexSerializer.supportsOrderinganswering true:IndexSelectionUtilTest, and on Lucene the text order test and the strategy test fail withCould not call index(unexpected docvalues type NONE for field 'title'), and, for the first, the UUID tests too (Unsupported order specified on field [uid]).IndexInformation.supportsOrderingfalse:IndexSelectionUtilTest, whose provider which doesn't implement it covers no order.MetricInstrumentedIndexProvidernot forwarding the method:MetricInstrumentedIndexProviderTest.unexpected docvalues type NONE). Sorting by aDEFAULTone, whichMapping.getMappinggives asDEFAULTrather thanTEXT: the text order test (unexpected docvalues type NONE for field 'note'). Not sorting by aTEXTSTRINGkey: the profile check ofheading. Not by aSTRINGkey:testOrderingListProperty's profile check ofDESC(name1). Sorting by a UUID key: the UUID tests (Unsupported order specified on field [uid]). By no number, date or boolean:testOrderingListProperty's profile check ofDESC(age1). Each also failsLuceneIndexTest.testOrderingSupport.Fielddata is disabled on [title]); ignoring the string analyzer: the analyzed test (Fielddata is disabled on [code]); ignoring it for aTEXTSTRINGkey alone: the analyzed test (Fielddata is disabled on [caption__STRING]); not sorting by aTEXTSTRINGkey: the profile check ofheading. Each also failsElasticsearchIndexTest.testOrderingSupport, which alone catches not sorting by a UUID key, which leaves the graph tests with the same results, as JanusGraph sorts UUIDs as the index does, and sorting by a geoshape key.Text fields are not optimised for operations that require per-document field data like aggregations and sorting, fortitleandcode.[3, 5, 1, 2, 7]for[2, 3, 5, 7, 1], and the strategy test[d, c, b, a]for[a, c, b, d]. Sorting by aDEFAULTone, deciding byMapping.getMappingrather thangetStringMapping: the text order test's order bynotereturns[4, 7, 2]for[2, 5, 7]. Not sorting by aTEXTSTRINGkey: the profile check ofheading. Each also failsSolrIndexTest.testOrderingSupport, which alone catches not sorting by aSTRINGkey with a string analyzer, or by a UUID key.On master
3148803d4, with these tests, but for the unit tests, which call the new methods:testOrderByATextKeyIsSortedByJanusGraphand the strategy test fail withJanusGraphException: Could not call index, caused byIllegalStateException: unexpected docvalues type NONE for field 'title' (expected=SORTED). Re-index with correct docvalues type.;testUUIDsAreOrderedAsTheirStringFormsandtestOrderByUUIDPutsElementsWithoutTheKeyLastwithIllegalArgumentException: Unsupported order specified on field [uid] with datatype [class java.util.UUID].Could not call index, caused by a400 Bad Request:Fielddata is disabled on [title] in [janusgraph_mixed]. Text fields are not optimised for operations that require per-document field data like aggregations and sorting, so these operations are disabled by default., and the analyzed test with the same for[code].[3, 5, 1, 7, 2]where TinkerGraph gives[2, 3, 5, 7, 1], which is the order of the least word of each title, and the strategy test returns[d, c, b, a]for[a, c, b, d]ascending, the vertex without a title first.kindandtitle, and bytitleandkind, each run on its own on master, fail on Lucene (unexpected docvalues type NONE for field 'title') and on Elasticsearch (Fielddata is disabled on [title]), and Solr returns[6, 3, 1, 7, 2]for[6, 2, 3, 7, 1]and[7, 2, 1]for[1, 7, 5].Locally, Java 11, with checkstyle (no violations):
BerkeleyElasticsearchTest(147, 1 skipped) andElasticsearchIndexTest(317) against Elasticsearch 9.5.4 in a container, andJanusGraphIndexTeston Solr 9.10.1 in the JVM,SolrRunner's MiniSolrCloud with BerkeleyJE asBerkeleySolrTestconfigures it (135, 1 skipped), with the harness'scollections.txtgiven thelistPropertyOrderingcollection, which master'stestOrderingListPropertyneeds. Against OpenSearch 3.9.0 (-Popensearch3), the new tests ofBerkeleyElasticsearchTest, its strategy and UUID tests, andElasticsearchIndexTest.testOrderingSupportpass.IndexSelectionUtilTest, and the positive profile check of the Elasticsearch test, the tests of this PR pass again:IndexSelectionUtilTest,MetricInstrumentedIndexProviderTest, the text order, strategy and UUID tests andtestOrderingListPropertyon Lucene, andLuceneIndexTest'stestOrderingSupportandtestSupport; the text order, analyzed, strategy and UUID tests on Elasticsearch 9.5.4, andElasticsearchIndexTest's two; the text order, strategy and UUID tests on Solr in the JVM, andSolrIndexTest's two.Notes
DEFAULTkey whose values are single words, the order was right but for case. JanusGraph now reads every match before it returns the first one, and a query of 1,000,000 matches or more fails with aQueryException. The changelog warns of this, and says how to map a key to have the index sort by it, which takes a new key, or a new index and a reindex.supports(...)methods do, not by the index's actual mapping or schema. A key which an Elasticsearch mapping of one's own (index.[X].elasticsearch.create.use-external-mappings) or a Solr schema of one's own (dyn-fieldsdisabled, or amapped-name) holds otherwise than JanusGraph would is answered by its JanusGraph mapping: such aTEXTkey in a field which the backend can sort by, such as akeyword, is now sorted by JanusGraph, which gives the same results, and aSTRINGkey in a text field still has the index sort by it. An Elasticsearchtextfield givenfielddataby a custom parameter would be sorted by its words, not by the strings, so leaving it to JanusGraph is right there too.index-performance.mdand the UUID section of the changelog said fails.IndexSerializer.getQuery(orAbstractIndexSelectionStrategy.addToJointQuery, which calls it), as none of JanusGraph's strategies or the tests' strategies does, can still have the index sort by such a key; JanusGraph doesn't strip such an order.graph.indexQuery(...).orderBy(...)) still gives the index the order it is asked for.TestMockIndexProviderforwards the new method as it forwardssupports(...); as test infrastructure, it isn't mutation-tested.indexCoversOrdertakes an order key whose field in the index isn'tENABLED, butREGISTEREDorINSTALLED, as one which the index can sort by, asMixedIndexType.indexesKeyholds such a field, while the conditions (AbstractIndexSelectionStrategy.coversAll),GraphCentricQueryBuilder.requireValuesandJanusGraphMixedIndexAggSteptake onlyENABLEDfields.ElasticSearchIndex.supportsOrderingdoesn't consider the custom parameters of a key, such asdoc_values: falseor anormalizer, which change whether or how Elasticsearch sorts by it.🤖 Generated with Claude Code