List<String> doRetrieve(GroupVersionKind type, ListOptions options, Sort sort) {
        var indexer = indexerFactory.getIndexer(type);

        StopWatch stopWatch = new StopWatch(type.toString());

        stopWatch.start("Check index status to ensure all indexes are ready");
        var fieldNamesUsedInQuery = getFieldNamesUsedInListOptions(options, sort);
        checkIndexForNames(indexer, fieldNamesUsedInQuery);
        stopWatch.stop();

        var indexView = new QueryIndexViewImpl(indexer);

        stopWatch.start("Evaluate selectors for index");
        var resultSet = evaluateSelectorsForIndex(indexer, indexView, options);
        stopWatch.stop();

        stopWatch.start("Sort result set by sort order");
        var result = indexView.sortBy(resultSet, sort);
        stopWatch.stop();

        if (log.isTraceEnabled()) {
            log.trace("Retrieve result from indexer by query [{}],\n {}", options,
                stopWatch.prettyPrint(TimeUnit.MILLISECONDS));
        }
        return result;
    }
@Test
    void doRetrieve() {
        var indexer = mock(Indexer.class);

        var gvk = GroupVersionKind.fromExtension(DemoExtension.class);

        when(indexerFactory.getIndexer(eq(gvk))).thenReturn(indexer);

        pileForIndexer(indexer, PrimaryKeySpecUtils.PRIMARY_INDEX_NAME, List.of(
            Map.entry("object1", "object1"),
            Map.entry("object2", "object2"),
            Map.entry("object3", "object3")
        ));

        pileForIndexer(indexer, LabelIndexSpecUtils.LABEL_PATH, List.of(
            Map.entry("key1=value1", "object1"),
            Map.entry("key2=value2", "object1"),
            Map.entry("key1=value1", "object2"),
            Map.entry("key2=value2", "object2"),
            Map.entry("key1=value1", "object3")
        ));

        pileForIndexer(indexer, "slug", List.of(
            Map.entry("slug1", "object1"),
            Map.entry("slug2", "object2")
        ));

        var listOptions = new ListOptions();
        listOptions.setLabelSelector(LabelSelector.builder()
            .eq("key1", "value1").build());
        listOptions.setFieldSelector(FieldSelector.of(equal("slug", "slug1")));

        var result = indexedQueryEngine.doRetrieve(gvk, listOptions, Sort.unsorted());
        assertThat(result).containsExactly("object1");
    }