SOLR custom sort [1]

Source: Internet
Author: User
Tags solr solr query idf

Requirements: Commodity sorting, inventory-free items in the back (sort).

Search:

Default search: DF:

You can see that the 1th and 6th stock in the left figure is 0.

Now the demand is to put the two stocks of 0 of the goods in the last side.

edismax-"BF:Product (Map (store,1,9999999,1), +) , with the effect shown on the right.

Rules for Store Map:

Store=0,v (store) = 0;

Store>0,v (store) = 1; (the default store's maximum value is 999999999)

Product*100, in order to highlight the effect of weighting. (Can be ignored)

Observe the details of the scoring:

 <str name= "92011786" >12.634275 = (match) sum of:2.0679202 = (match) sum of:1.2457463 = (match) weight (SEARCHF        ield:165 in 18377) [defaultsimilarity], result of:1.2457463 = score (doc=18377,freq=2.0 = termfreq=2.0), Product of: 0.77180904 = queryweight, Product of:7.3044024 = IDF (docfreq=78, maxdocs=43211) 0.105663545 = qu Erynorm 1.6140602 = fieldweight in 18377, product of:1.4142135 = TF (freq=2.0), with Freq Of:2 .0 = termfreq=2.0 7.3044024 = IDF (docfreq=78, maxdocs=43211) 0.15625 = Fieldnorm (doc=18377) 0.8221738 3 = (MATCH) weight (Searchfield: Refreshing in 18377) [defaultsimilarity], result of:0.82217383 = score (doc=18377,freq=2.0 = t          ermfreq=2.0), Product of:0.6270135 = queryweight, Product of:5.934057 = IDF (docfreq=310, maxdocs=43211) 0.105663545 = Querynorm 1.3112538 = fieldweight in 18377, product of:1.4142135 = TF (freq=2.0), W            ITH freq of:2.0 = termfreq=2.0 5.934057 = IDF (docfreq=310, maxdocs=43211) 0.15625 = Fieldnorm (doc=18377) 10.566355 = (MATCH) functionquery (product (Map (int (store), 1.0,9999999.0,const (1), const)), Product of:100.0 = Product (Map ( int (store) =10,min=1.0,max=9999999.0,target=const (1)), const (+)) 1.0 = Boost 0.105663545 = querynorm</str>

From the above you can see the total score of 12.634275 for text 2.0679202 plus inventory plus 10.566355.

Extended reading:

Http://wiki.apache.org/solr/DisMax

Dismax is an abbreviation disjunction Max, and was a popular query mode with SOLR.

Simply put, it's your choice for all user generated queries.

Out of the box, SOLR uses the standard SOLR query parser which are pretty stupid, understanding only syntactically correct Boolean queries like "Title:foo OR Body:foo", it can be only search one field by default, and it could very well throw an excep tion in your face if you put in some characters it does isn't like.

Therefore a new, more robust query mode is needed and the Dismax and Extendeddismax query parsers were born. They is designed to process simple user entered phrases (without heavy syntax) and search for the individual words across Several fields using different weighting (boosts) based on the significance of each field, and it should never throw a E Xception.

disjunction refers to the fact that your search was executed across multiple fields, e.g. title, Body and keywords , with different relevance weights

Max means that if your word "foo" matches both title and body, the max score of these (probably title match) is added to the score, not the sum of the the same as a simple OR query would do. This gives more control over your ranking.

Dismax is usually the short name for the actual query parser and so don ' t being confused. The old Dismax parser have been around for some time, while the new and most advanced Extendeddismax parser was introduced In Solr3.1 as experimental.

There is a Lucid imagination Blog post that explains the origins and conceptual behavior of Dismax functionality.

Functionquery:

Http://wiki.apache.org/solr/FunctionQuery#map

Extendeddismax[edismax]:

Http://wiki.apache.org/solr/ExtendedDisMax

SOLR custom sort [1]

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.