0 hits on lucene search

I am trying to get all confirmed orders using the following code:

List<Guid> returnList = null;

        var defaultLanguage = _languageService.GetDefault();

        var request = new QueryRequest(defaultLanguage.SystemId, ECommerceSearchDomains.Orders, token);


        request.FilterTags.Add(new Tag(TagNames.OrderStatus, (short)OrderState.Confirmed));

        var searchResult = Solution.Instance.SearchService.Search(request);

        if (searchResult != null)
        {
            returnList = searchResult.Hits.Select(x => new Guid(x.Id)).ToList();
        }
        return returnList ?? new List<Guid>();

The search return 0 hits, eventhough there are a number of orders in the database with the confirmed status. Trying to search for a specific order id also returns 0 hits.

Litium version: 7.1

Have you tried rebuilding the Sales index?

I ran your code in a 7.1 accelerator (only substituting token for Solution.Instance.SystemToken) and it worked as expected.

Thank you for testing! I have indeed rebuilt the sales index with no luck.

Edit: I have now passed in the correct token and the search works fine. Thanks Nils :slight_smile:

1 Like