2d barcode vb.net Query boosting in Java

Create Data Matrix ECC200 in Java Query boosting

12.2.2 Query boosting
Make Data Matrix 2d Barcode In Java
Using Barcode generation for Java Control to generate, create ECC200 image in Java applications.
www.OnBarcode.com
Read ECC200 In Java
Using Barcode scanner for Java Control to read, scan read, scan image in Java applications.
www.OnBarcode.com
We briefly mentioned query boosting in the t.getBoost(t) paragraph of the DefaultSimilarity class. Let s change listing 12.6 slightly and apply a boost factor to our query term of war in listing 12.10. Before we apply the boost, we say that war should appear in the results, and by adding a boost to it we are saying that if war does appear, score it higher than those results where it does not appear.
Printing Code 39 Extended In Java
Using Barcode creation for Java Control to generate, create Code 39 image in Java applications.
www.OnBarcode.com
2D Drawer In Java
Using Barcode maker for Java Control to generate, create 2D Barcode image in Java applications.
www.OnBarcode.com
Document ranking
EAN / UCC - 13 Maker In Java
Using Barcode creation for Java Control to generate, create EAN / UCC - 14 image in Java applications.
www.OnBarcode.com
Making PDF 417 In Java
Using Barcode encoder for Java Control to generate, create PDF 417 image in Java applications.
www.OnBarcode.com
Listing 12.10 Boosting one term of a two-term query to score it higher
Create GS1 DataBar-14 In Java
Using Barcode creation for Java Control to generate, create GS1 DataBar image in Java applications.
www.OnBarcode.com
Print British Royal Mail 4-State Customer Barcode In Java
Using Barcode generator for Java Control to generate, create RoyalMail4SCC image in Java applications.
www.OnBarcode.com
BooleanQuery query = new BooleanQuery(); query.add(new BooleanClause(new TermQuery( new Term(FIELD_NAME, "spielberg")), BooleanClause.Occur.MUST)); TermQuery war = Double the query new TermQuery(new Term(FIELD_NAME, "war")); boost factor war.setBoost(2.0F); BooleanClause c = new BooleanClause(war, BooleanClause.Occur.SHOULD); query.add(c); System.out.println(query.toString());
Data Matrix Generator In Visual C#
Using Barcode drawer for VS .NET Control to generate, create ECC200 image in .NET framework applications.
www.OnBarcode.com
ECC200 Encoder In VS .NET
Using Barcode drawer for Visual Studio .NET Control to generate, create ECC200 image in .NET applications.
www.OnBarcode.com
org.hibernate.search.FullTextQuery hibQuery = session.createFullTextQuery(query, Product.class); hibQuery.setProjection(FullTextQuery.DOCUMENT, FullTextQuery.SCORE, FullTextQuery.DOCUMENT_ID); List<Object[]> results = hibQuery.list(); assert results.size() > 0: "no results returned"; for (Object[] result : results) { System.out.println("score => " + result[1]); System.out.println(hibQuery .explain((Integer)result[2])); }
Draw PDF 417 In None
Using Barcode drawer for Font Control to generate, create PDF 417 image in Font applications.
www.OnBarcode.com
1D Barcode Encoder In C#
Using Barcode drawer for Visual Studio .NET Control to generate, create Linear Barcode image in .NET framework applications.
www.OnBarcode.com
C Examine the explanation
Scan PDF 417 In Visual Basic .NET
Using Barcode reader for .NET Control to read, scan read, scan image in VS .NET applications.
www.OnBarcode.com
Scan GS1 - 12 In VS .NET
Using Barcode recognizer for .NET Control to read, scan read, scan image in VS .NET applications.
www.OnBarcode.com
Here, in listing 12.11, is the explanation of the results, which we are going to compare with listing 12.7. We are showing only the top two results here.
PDF-417 2d Barcode Maker In .NET
Using Barcode encoder for ASP.NET Control to generate, create PDF-417 2d barcode image in ASP.NET applications.
www.OnBarcode.com
Generating Barcode In None
Using Barcode maker for Font Control to generate, create Barcode image in Font applications.
www.OnBarcode.com
Listing 12.11 The explanation of the results after boosting a term in a two-term query
Barcode Generator In Visual Studio .NET
Using Barcode maker for ASP.NET Control to generate, create Barcode image in ASP.NET applications.
www.OnBarcode.com
Painting GTIN - 13 In None
Using Barcode drawer for Office Excel Control to generate, create GS1 - 13 image in Excel applications.
www.OnBarcode.com
score => 0.86979103 The top score has decreased 0.86979103 = (MATCH) sum of: 0.485959 = (MATCH) weight(description:spielberg in 230), product of: 0.5173574 = queryWeight(description:spielberg), product of: The queryNorm 4.338487 = idf(docFreq=16) has decreased 0.11924834 = queryNorm 0.93931 = (MATCH) fieldWeight(description: spielberg in 230), product of: 1.7320508 = tf(termFreq(description:spielberg)=3) 4.338487 = idf(docFreq=16) 0.125 = fieldNorm(field=description, doc=230) The queryWeight 0.383832 = (MATCH) weight(description:war^2.0 in 230), increased for war product of: 0.8557694 = queryWeight(description:war^2.0), product of: 2.0 = boost
Barcode Decoder In .NET
Using Barcode recognizer for Visual Studio .NET Control to read, scan read, scan image in Visual Studio .NET applications.
www.OnBarcode.com
Make Barcode In None
Using Barcode maker for Software Control to generate, create Barcode image in Software applications.
www.OnBarcode.com
E boost factor
Double the query
Exploring Lucene s scoring approach and the DefaultSimilarity class
3.5881817 = idf(docFreq=35) 0.11924834 = queryNorm 0.44852272 = (MATCH) fieldWeight(description:war in 230), product of: The queryNorm 1.0 = tf(termFreq(description:war)=1) has decreased 3.5881817 = idf(docFreq=35) 0.125 = fieldNorm(field=description, doc=230)
score => 0.6644006 0.6644006 = (MATCH) sum of: 0.28056857 = (MATCH) weight(description:spielberg in 15), product of: 0.5173574 = queryWeight(description:spielberg), product of: 4.338487 = idf(docFreq=16) 0.11924834 = queryNorm 0.5423109 = (MATCH) fieldWeight(description:spielberg in 15), product of: 1.0 = tf(termFreq(description:spielberg)=1) 4.338487 = idf(docFreq=16) 0.125 = fieldNorm(field=description, doc=15) 0.383832 = (MATCH) weight(description:war^2.0 in 15), product of: 0.8557694 = queryWeight(description:war^2.0), product of: 2.0 = boost 3.5881817 = idf(docFreq=35) 0.11924834 = queryNorm 0.44852272 = (MATCH) fieldWeight(description:war in 15), product of: 1.0 = tf(termFreq(description:war)=1) 3.5881817 = idf(docFreq=35) 0.125 = fieldNorm(field=description, doc=15)
We d be willing to bet that this isn t what you expected. Comparing this to listing 12.7, you can see that the document scores actually dropped B, but the things we expected to change have changed in exactly the way we expected:
The document s ranking has not changed. Result 1 in listing 12.7 is still result 1 here. Result 2 is still result 2, and so on. The 2.0 boost factor E for the war term increased the query weight for that term from 0.63732624 to 0.8557694 D.
The queryNorm value decreased C since the war term weight increased. We weren t expecting it to have that big of an impact. Remember, the queryNorm value doesn t affect document ranking; it affects matching documents scores equally. Its main purpose is to make scores comparable between dissimilar queries or even different indexes. This is the example we promised to show you when we talked about the queryNorm quantity. This example doubles your return. It shows both the effect of boosting a term in a query and what that does to the queryNorm calculation. Some other components also affect document scoring, namely, the Scorer class and the Weight class, and we have to warn you that working with these classes is not
Document ranking
for the faint of heart. It will really help you to keep things straight if you remember the following facts about each of these classes: The Scorer class:
Calculates document scores based on a given Similarity Is created by a Weight class via Weight.scorer(IndexReader reader)
The Weight class:
Is created by a query: Query.createWeight(IndexSearcher searcher) Is an internal representation of the query that allows the query to be reused by the searcher
Copyright © OnBarcode.com . All rights reserved.