-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Modifying search query so one field scores higher over others? #139
Comments
Ah, I think I figured out where I change things... really quite simple I think. I see the DisMax query parser in the solrconfig.xml file. I believe if I just modify things to how we want them in there, everything should work. UPDATE: Well, I modified, successfully reloaded it into solr, and it still doesn't seem to work the way I want to (the search doesn't seem to have changed at all). The field I want to add is "identifier." So here is basically what I added:
I am searching for an exact match in the identifier using a specific format. For the sake of simplicity, let's say it's called "Document(1900) No. 15". So when someone types that into the search box, the document with that identifier should be the very first to come up. At the moment it's not - it's about the fifth document to come up. The other documents mention this document in the text, and they are coming up prior to this one. Why would that be? |
Hi all, so I tried boosting the identifier more (^20) and I also tried moving it to the front of the line (before text) just to see if that made a difference and it didn't. Do I also need to change another file somewhere to reflect that I'm adding the identifier field here? I couldn't tell from the schema file if that was necessary or not. |
I've been working a bit on the SolrSearch_ResultsController::_getQuery() method myself, as it is neither fully allowing or fully escaping the Lucene query syntax. One thing I've discovered is that most metadata fields are indexed with unintuitive names in Solr. Basically, anything that you mark as "Is Indexed?" in the Solr Search plugin Field Configuration will be indexed in a field that is named For example in one of my installations the Identifier field has an You should also be able to query that field in your query string with Looking through other forks of the plugin, I did find this commit from @jajm that appears to give more intuitive names to the fields in Solr: biblibre@48ab77d |
Thanks -- and you're right. I actually figured out how to change that in the solrconfig.xml file yesterday and it worked (I was trying to do it for the Identifier field in our installation, which was 43_t ). I had to modify the default /select handler and added an edismax with qf. In the end it looked like this:
I'll probably have to modify it again at some point based on additional criteria. But at least I figured out how to get this to work! |
Thanks for pointing out the EDisMax query parser. It performs much better than the standard query parser, and gracefully handles syntax issues like single quote problem reported in #137. I've updated the I specified using EDisMax in the query string instead of the The other changes I made to the method were to remove the parts that stripped characters from the query, and to add plus signs to the facets and public field so that they are required when using EDisMax. Without the plus signs, documents that did not match the facets could still be selected. |
Excellent! So should I get rid of the solrconfig.xml code I changed and just replace the |
Right, I only changed I was hesitant about specifying to use EDisMax in the code, as unlike the |
Has anyone yet modified this plug-in's query so it scores a field higher over others? It should be possible according to the SolrRelevance FAQs wiki. Specifically, I want to do this:
I think what I need to do is somehow change the code in the ResultsController.php here:
Am I right? Has anyone already done this before?
The text was updated successfully, but these errors were encountered: