Solr: how to custom score - solr

I'm using solr 4.5.
I would like to customize solr score using in my "formula" the termFreq and PhraseFreq (it depend if in the query i have an term or a phrase).
Now I'm using in a url request the param:
sort=myFormula desc
it works but my problem is that in output i want also the output of my formula, now the solution is or to put the formula also into fl param or to customize the score :) and i'm looking for the last one solution.
Please, do you have any suggest or link/guide to give me to learn how is it possible customize the solr score? I'm searching on google but no results relevant.
Thanks in advance.

How about implementing your own CustomScoreQuery? The second example here as well as this blog post talk about how to do it.

Related

How score is calculated in solar in edismax algorithm?

How score is calculated in solar in edismax algorithm?
I have idea of qf, pf, pf2, pf3 and mm. But I have no idea what is formula used to get score of query({!field f=query_s v=$q}).
I am using LucidWorks, I have added the screenshot for your reference. I need to know exact formula or algorithm in which qf, pf, pf2, pf3 makes their contribution in calculating the score. Algorithm with a proper example is really helpful for me.
Screenshot of details parameter
In your situation, it's the Lucidworks code that implements that stage that would have to add the "debug=all" value to its call to Solr. It would also have to transfer the response to some part of the Fusion response.
It's likely easiest to just create the Solr query that the stage would create, and run it yourself, either through the Solr Admin UI or directly to the Solr endpoint.

word proximity not working in apache solr

I am using dismax parser to boost phrase queries like following
qf=story_title^5.0+tax_payer_name+judgement_text^1.0+story_description^1.0+tax_payer_name+nature_of_the_issues+decision_summary+additional_comments+facts_of_the_case+section_number';
pf=story_title^5.0+&pf=judgement_text+story_description^1+nature_of_the_issues+decision_summary+additional_comments+facts_of_the_case+section_number';
qs=3';
ps=3';
but whenever i search like 54F beed registration , some results come up where , there are more registration word recurring and not 54F beed registration
Somewhere i found that solr score depends on percentage of word repeating in document
how can we override this behavior to achieve desired results in solr?
Thanks in advance.
I don't think there's an omitTermFreq setting yet, even if it has been mentioned many times.
A possible solution is to create your own similarity class by subclassing DefaultSimilarity, and returning 1.0f as the tf value.
See Solr Custom Similarity for an on how to implement a custom similarity class. Recent versions of Solr (4.0+) supports a custom similarity class per field.

How can I match subdomains in a solr search?

I can found domains using ClassicAnalyzer.
Given a doc with a domain like facebook.com, what is the best approach to match queries like
faceboook.com (obvious)
xyz.facebook.com
abc.xyz.facebook.com
facebook
Any combination of analyzers (tokenizers, filters...) or approches to build my own will be welcomed.
Thx!
I think in this case StandardTokenizer helps better. It Preserves Internet domain names and email addresses as a single token. it helps if you post an example document and few search terms that you would like to match.
Update: Look at text_general field type , that does exactly what you are looking for. I ran analysis for xyz.facebook.com,faceboook.com,abc.xyz.facebook.com and facebook and it kept each of them together and matched the way you wanted.
I ended using a PatternCaptureGroupFilter with a pattern like ([a-zA-Z\-_0-9]+)

Own filter Solr

have long since I have been researching, but so far have not found anything to solve my problem. I'm trying to create a filter for Solr, which add a TOKEN. For example, the entry is "Football" and the output is "Football" and "Brazil." If possible I would like a practical example. Thanks in advance.
Instead of a filter you can use SynonymFilterFactory to add Synonyms as mentioned in your example.
This will allow you map terms and related terms, which would get added to the index.

field listing in solr with "fl" parameter for a field having space in between

I have a field in my solr schema as "Post Date"(exclude the quotes). when i fire a query with "fl" (field list) parameter in order to view only Post Date of search results, since this field contains a space I am not getting anything in the docs responses. I tried using +, %20 but still i get no results. Please help.
I would like to inform that i have found a solution to this. I tried experimenting and hence came up with a solution on putting \+ as the substitute for white space in the query. Hence the query should be Post\+Date:[ranges]
I couldnt aford to change my schema as many teams are depending on it and we are upgrading our system to a new search engine.
You can specify (what Solr deems crazy) fields by wrapping them like this:
field(Post Date)
This actually changes the returned results fieldname too so you'll get back something like:
"field(Post Date)" : "2010-01-01"
And not just the name as you might imagine.
As a possible workaround, you might be able to use a wild card to achieve your results. Using the solr wiki http://wiki.apache.org/solr/CommonQueryParameters#glob you may be able to specify fl=Post*Date which would possibly get around your problem. I have not verified this but it might work.
Update: This doesn't seem to work on either version of solr I tried (1.4.0 and 3.6.1). Looks like this may have been discussed at http://wiki.apache.org/solr/FieldAliasesAndGlobsInParams but it does not appear to be implemented.

Resources