Error when getting "Suggestions" from ShardedDocumentStore: "You cannot get database commands for this query"

StackOverflow https://stackoverflow.com/questions/22690531

  •  22-06-2023
  •  | 
  •  

Question

I recently started using a sharded document store in my project. Going back through some old functionality that was working I am now getting an error. Wondering if getting suggestions across a sharded data store is not supported yet? Getting error "You cannot get database commands for this query" when calling "Suggest". Not sure what else to try at this point.

        using (var session = Store.OpenSession())
        {

                var query = session.Query<Item>("ItemIndex").Statistics(out stats)
                    .Search(x => x.Title, searchCriteria.Title)
                    .Where(x => x.ItemZip.In(zipcodes))
                    .Skip(pageNumber * 40)
                    .Take(40); // Take posts in the page size

                toReturn = query.ToList();

                if (toReturn.Count() == 0)
                {
                    var results = query.Suggest(new SuggestionQuery()//<---- error here
                                        {
                                            Field = "Title",
                                            Term = searchCriteria.Title,
                                            MaxSuggestions = 1,
                                            Accuracy = 0.4f,
                                            Popularity = true,
                                        }).Suggestions;
                    if (results.Count() > 0)
                    {
                        searchCriteria.AlternateSearch = results[0];
                    }
                }
Was it helpful?

Solution

Google groups response from Oren. "...it isn't supported currently"

https://groups.google.com/forum/#!topic/ravendb/ksJcQD1OJqE

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top