What means "document popularity" in Solr - solr

What is document popularity in solr indexing..?
EDisMax parser uses boost parameter. In the example &boost=popularity like that I noticed one query. I couldn't understand what is boost as well as boost=popularity. Before understanding the boost parameter I'd like to know what is "popularity" in document indexing.

popularity is just "some field" which has been used as an example while boost is a query parameter defined for the edismax request handler. Boosting means to influence the scoring (the relevance of each search hit) depending on some field value (or result of some function based on field values).
See section The boost Parameter in https://cwiki.apache.org/confluence/display/solr/The+Extended+DisMax+Query+Parser.
If you want to implement something like popularity in your own index you would have to:
add a field to your schema called popularity with type int or float or ExternalFileField (depends on how you index and apply it).
gather statistics data for your search results and store those in relation to the document IDs (e.g. by evaluating access logs)
during index time or via ExternalFileField (or in the future via docValues partial updates) store the popularity values that you get from your statistics data.
apply the boost during query time by setting the parameter boost=popularity (or using popularity in a function query).
More on popularity boosting:
https://www.slideshare.net/lucenerevolution/potter-timothy-boosting-documents-in-solr
docValues partial update:
https://issues.apache.org/jira/browse/SOLR-5944
ExternalFileField:
http://www.findwise.com/blog/externalfilefield-in-solr/

Boosting is used to increase the score of the certain documents. You can use index time boosting or query time boosting. For index time boosting you can set boost attribute and value to the document you index. For query time boosting you can either boost field by setting your boost value, or you can use predefined function queries.
For more information about boosting check documents in Solr wiki.
boost=popularity means that documents popularity is calculated in the external field (using ExternalFileField) and used to increase the score by using popularity value. Popularity of the documents can be calculated using the view count or any other parameters you want.For more about boosting documents by popularity you can check this document.

Related

How can I change the score of a document based on the *Price* of a field (say, "popularity") in solr

How to boost record depend on any field in Solr.
Reference link :https://wiki.apache.org/solr/SolrRelevancyFAQ#How_can_I_increase_the_score_for_specific_documents
But I am not getting clearlly in my case.
I have some record after search
How to get Id : 5,8,17 and 1 up some step not top of the list, just boost some step.Because it's price is higher.
It's my row query ;
select?mm=100%25&version=2.2&q=(book)&defType=edismax&spellcheck.q=(book)&qf=Price^10+Name^1+nGramContent&spellcheck=true&stats=true&facet.mincount=1&facet=true&spellcheck.collate=true&stats.field=Price&rows=50&indent=on&wt=json&fl=Id,score,Price
Please help me.
Thanks!
The qf parameters are for hits in the field and will not affect the ranking unless the query produces a hit in the field. Your example would require you to search for the price (and not book) for anything to be boosted by the qf=Price^10 argument.
The FAQ you've linked to answers your question, just not the question you've referenced: How can I change the score of a document based on the value of a field. From the example (replace popularity with price for your case):
# simple boosts by popularity
defType=dismax&qf=text&q=supervillians&bf=popularity
q={!boost b=popularity}text:supervillians
# boosts based on complex functions of the popularity field
defType=dismax&qf=text&q=supervillians&bf=sqrt(popularity)
q={!boost b=sqrt(popularity)}text:supervillians
edismax makes the {!boost} (multiplicative boost) available as the boost= parameter as well, so you can reference it directly instead of having it in your query.

Which one to use for boosting bq or q.alt

As the title says which one I need to use for boosting in solr. whether its q.alt or bq. I tried the boosting in both however I'm not clear on how the boosting is working. Because in q.alt I got the correct results when I specified boosting value as 1000 at the same time I got the same results in bq with the boosting value as 2
Can someone help me to get the best practices for boosting?
My SOLR version is 3.5.
It depends upon what are you trying to boost.
Use qf (query fields) - to boost the individual search fields which have different weightage.
for e.g. For a document title has a higher weightage then description then you would use title^2 description^1
q.alt is just an alternate query factor in case on q is specified.
Use bq and bf for boosting certain matches, ranges or when the need to apply some functions on them. These usually are the extar boost and not the part of the search boost.
for e.g. for latest documents you would boost by date, or Price range or you want to boost on sum of fields etc ...
use qf parameter for boosting
Dismax Query Parser Wiki

Solr Boost on non-query term

All my results are of type "active, inactive, historical" - this is a field indexed by Solr.
I want my results to be returned with a boost to type="active".
I could do ordering which will suffice, but its not great.
So, when a user searches for a term "sick", they get the most relevant results to sick, but with a higher boost for documents where its active.
Not just a sorted result set!
You can use the edismax parser and the following boost query bq paramter to get your desired results to be boosted to the top...
http://localhost:8983/solr/select/?q=sick&defType=edismax&bq=type:active^5.0
In this example you are adding a boost query to increase the relevancy of documents whose type is active.
Here are some more examples on the Solr Wiki DisMaxQParserPlugin page.
The above example will create an additive boost.
If you want an multiplicative boost for "type=active" you could add:
&boost=if(termfreq(type,"active"),2,1)
Which gives a factor 2 boost for "type=active"

How to boost fields in solr

I already have the boost determined before hand. I have a field in the solr index called boost1 . This boost field will have a value from 1 to 10 similar to google PR rank. This is the boost that should be applied to every query ran in solr. here are the fields in my index
Id
Title
Text
Boost1
The boost field should be apply to every query. I am trying to implement functionality similar to Google PR rank. Is there a way to do this using solr?
you can add the boost during query e.g.
q={!boost b=boost1}
How_can_I_boost_the_score_of_newer_documents
However, this may need to be added explicitly by you.
If you are using dismax or edismax with the request handler, The bf (Boost Functions) parameter could be used to boost the documents.
http://wiki.apache.org/solr/DisMaxQParserPlugin#bf_.28Boost_Functions.29
bf=boost1^0.5
This can be added to defaults with the request handler definition, so that they are applied to all the search queries.
you can use function queries to vary the amount of boost FunctionQuery
I think you need to use index time document boosts. See this if you are indexing XML or this if using DataImportHandler.

How to score high of document containing "Burj Khalifa" in title and then in summary field in SOLR

I want to sort document by relevancy i.e. First all docs having "Burj Khalifa" in title and then in summary field? and sort by publishdate as well. means latest documents must have high score.
criteria is like sort by score with publishdate
http://localhost:8080/solr/select?sort=score+desc,publishdate+desc&q=Burj Khalifa
I think you don't want sorting in this case, as it defines a strict ordering on the result set. Instead, I'd use DisMax with a FunctionQuery (see here to boost newer documents) and the qf parameter to boost the title field.
You'll have to play a bit with the boost values to get optimal results.

Resources