Gravatar for andrew.harbert@nttdata.com

Question by adharbert, Jun 9, 2014 3:54 PM

Search results won't return more than 10 records

I'm doing a simple search using coveo,

ID nId = new ID("{76036F5E-CBCE-46D1-AF0A-4143F9B557AA}"); var results = context.GetQueryable().Where(p => p.TemplateId == nId).ToList();

I have over 400 records, if I run this as a fast query (searching on template Id), I get all returned, but for some reason coveo does not send the entire list.

Is there a setting or something I need to set to return full list? Seems very odd it only returns 10.

2 Replies
Gravatar for vseguin@coveo.com

Answer by Vincent Séguin, Jun 9, 2014 5:06 PM

Hi,

Have you tried specifying Take(400) for example? By default, the search will only return 10 results.

Gravatar for andrew.harbert@nttdata.com

Comment by adharbert, Jun 10, 2014 11:45 AM

I did add the Take(400) like you suggested and that did return more results. I see that being an issue, the results can grow over time, so specifying a number doesn't appear to be good practice. Is thee any reason why this doesn't return more than 10 items? Linq doesn't limit results, so why is this limiting the results? Is there a way to make it return all, without specifying the amount in Take()?

Gravatar for slangevin@coveo.com

Comment by Simon, Jan 7, 2015 1:47 PM

In December 2014, a new node int the CoveoSearchProvider.config called DefaultNumberOfResults allows you to change the default value without modifying your LINQ queries directly.

Gravatar for nbordeleau@coveo.com

Answer by Nicolas, Jun 10, 2014 1:44 PM

Hi,

The default number of results returned by the underlying search engine is 10. You can change that number to up to 1000 per single request. The reason behind this is that the search engine is not optimized to extract large amount of data, but to give you the most relevant results for your query.

What you should probably do is use the Page extension. It's pretty simple, if you ask two times for a page of 10, you'll end up with the 20 first results. Put that into a loop and look for the first page that is not full (ex.: A page of 5 results while you asked for 10), and you'll be able to get all the results you want from the search engine.

Ask a question