discoverdotnet icon indicating copy to clipboard operation
discoverdotnet copied to clipboard

[Suggestion] Improve Algolia Indexing

Open Ant-hem opened this issue 5 years ago • 0 comments

Hi there 👋

I am the maintainer of the Algolia Library and I noticed you are using it! That's awesome. I was curious and I took a look at the code base and I found out this part we could improve.

https://github.com/daveaglick/discoverdotnet/blob/e5e6a21672824ac63b49320e94b52b041c77f053/src/DiscoverDotnet/Modules/UpdateSearchIndex.cs#L51-L66

To get the entire index, one could simply do that:

var results = new List<JObject>();
foreach (var item in index.Browse<JObject>(new BrowseIndexQuery()))
{
     results.Add(item);
}

Browsing with the page parameter can lead to some issue. It's better to use the built-in Browse method.

Happy to PR this change if you would like!

Ant-hem avatar Dec 20 '19 19:12 Ant-hem