tags:

views:

146

answers:

1

I'm a Certified .NET developer who is responsible for implementing a Solr search via Solrnet. I'm close to having it where I need it, yet far from seeing the performance my client needs.

Normally, I wouldn't write, but I'm not finding much documentation. Can you offer some good Solrnet resources? Here's my problem:

How do I restrict the results set (documents) to say 25? I've limited my data grid to 25 results per page, but it's still very slow when even 1000 results come back. I'm guessing this is because Solr is actually returning all 1000 recs, even though I'm only displaying 25. Is this correct? It looks like my defaults are set for 10 in solrconfig, but it appears that Solrnet bi-passes that and gets everything.

I also need to set my Start and Rows parameters so I can do paging - this will increase speed greatly, right?

I was able to figure out how to handle the Sort parameter, by adding the following to my Solr.Query: new QueryOptions().AddOrder(new SolrNet.SortOrder("Popularity", Order.DESC)

But I don't see anything like this to set the Rows or Start parameters.

Any help you could offer would be greatly appreciated. Thanks -

Justin

A: 

QueryOptions has a lot of properties, among them are Start and Rows. If they're not defined, SolrNet will be default fetch a large number of documents (probably all documents you have). I did this because I thought it would be a less surprising behavior for new users, as it makes it more database-like. However this will likely change in the next release, in order to reflect the actual default as defined in your Solr configuration.

Here's an example of how to use the Start and Rows properties:

solr.Query(yourQuery, new QueryOptions {
  Rows = 10,
  Start = 20,
});

Take a look at the sample app for more guidance.

EDIT: I added this to the wiki documentation.

Mauricio Scheffer