JT_SIRO
asked on
Solr Lucene Scoring and Sorting problems
I'm not having much luck finding Solr help, but hopefully someone can help.
I've just set up Solr and am able to do searches but am unable to sort and the default scoring doesn't seem to be working. Does something need to be done to enable scoring and sorting in Solr?
I've tried every example that I could find online, which Solr seems to completely ignore. Neither of these did anything:
somewords ;Popularity desc
somewords &sort=Popularity desc
The scoring doesn't seem to be doing anything either. My search results come back in the order that they are stored every time. Exact matches are not ordered any higher than partials.
I know this isn't a specific sorlnet issue, but I don't know where to turn, as there is so little documentation to help. Please advise.
Thanks,
Justin
I've just set up Solr and am able to do searches but am unable to sort and the default scoring doesn't seem to be working. Does something need to be done to enable scoring and sorting in Solr?
I've tried every example that I could find online, which Solr seems to completely ignore. Neither of these did anything:
somewords ;Popularity desc
somewords &sort=Popularity desc
The scoring doesn't seem to be doing anything either. My search results come back in the order that they are stored every time. Exact matches are not ordered any higher than partials.
I know this isn't a specific sorlnet issue, but I don't know where to turn, as there is so little documentation to help. Please advise.
Thanks,
Justin
You are adding the &sort= to the url, not to the query, right? It would help if you can post the URL of the query.
ASKER
I'm using the Solrnet class to access Solr, so I don't actually build a URL per se. I use the .Query method of Solrnet, like this:
var solr = ServiceLocator.Current.Get Instance<I SolrOperat ions<Track Info>>();
var results = solr.Query("keyword1 -ExcludeWord &sort=Popularity asc");
It searches the text I pass it, as well as exclude text, but the sort is ignored.
There's very little documentation on this. Does it look like I'm using it incorrectly?
var solr = ServiceLocator.Current.Get
var results = solr.Query("keyword1 -ExcludeWord &sort=Popularity asc");
It searches the text I pass it, as well as exclude text, but the sort is ignored.
There's very little documentation on this. Does it look like I'm using it incorrectly?
ASKER
I read that the string passed in the solr.Query() function is passed to the q parameter for Solr.
Additional name / value parameters can be accessed by SolrNet, but they need to be declared. Maybe I need to create one for sort.
You'd think that sorting would be built in to solrnet
Additional name / value parameters can be accessed by SolrNet, but they need to be declared. Maybe I need to create one for sort.
You'd think that sorting would be built in to solrnet
As you surmised, adding the &sort=Popularity asc to the q parameter won't work. Just add a parameter "sort" with the value "Popularity asc". It looks like you can do this in Solrnet by passing a dictionary with those values.
ASKER
cwiedmann - I'll give you the points - sorry for the delay and thanks. I'm getting closer but still super slow searching...
Do you happen to know how to restrict the results set (documents) to 25? I've limited my data grid to 25 results per page, but it's still very slow when say 1000 results come back. I'm guessing this is because Solr is actually returning all 1000 recs, even though I'm only displaying 25. 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 param so I can do paging. I was able to figure out how to handle the Sort parameter, by adding the following to my Solr.Query:
new QueryOptions().AddOrder(ne w SolrNet.SortOrder("Popular ity", Order.DESC)
But I don't see anything like this to set the Rows or Start parameters. This should be so much easier, but it's clear that .NET users haven't worked with this much yet. Please advise!
Thanks -
Justin
Do you happen to know how to restrict the results set (documents) to 25? I've limited my data grid to 25 results per page, but it's still very slow when say 1000 results come back. I'm guessing this is because Solr is actually returning all 1000 recs, even though I'm only displaying 25. 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 param so I can do paging. I was able to figure out how to handle the Sort parameter, by adding the following to my Solr.Query:
new QueryOptions().AddOrder(ne
But I don't see anything like this to set the Rows or Start parameters. This should be so much easier, but it's clear that .NET users haven't worked with this much yet. Please advise!
Thanks -
Justin
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Good information but no specific Solrnet examples. Thanks!