Comments (2)
Upon researching this, I discovered that there was a bug in the ToString()
method in that it wasn't correctly returning the results of the facets, which will be addressed in the next release.
The results of the 2 queries are returning the exact same documents in the same order.
However, Lucene.Net uses a different scoring strategy than the default scoring of BoboBrowse.Net so the scores are different. If you look at the [Facet Scoring](https://linkedin.jira.com/wiki/display/BOBO/Facet+Query#FacetQuery-Scoring page) section, you can see that the score can be customized. So, I am not considering this a bug - it looks like this is normal behavior as the scores are defaulting to 1*boost and the score can be customized further if need be. Besides, scores are relative numbers, not absolute numbers and their relative values are correct. And there are quite a few tests covering this scenario that are all passing (TestFacetQueryBoost, TestFacetQuery, TestFacetQueryBoolean, TestFacetRangeQuery).
Comparing the output of ToString()
is not a good way to determine if the 2 results are the same. In the Lucene.Net case there are no facets being returned and as previously mentioned the scores are different. The score could be fixed by building a custom scoring function, and the facets will be included if you add a FacetSpec
as shown below, but you are better off comparing the individual values to ensure they appear in the same order and quantities.
// Bobo.
{
BrowseRequest browseRequest = new BrowseRequest();
browseRequest.Count = 10;
browseRequest.Offset = 0;
browseRequest.FetchStoredFields = true;
BrowseSelection sel = new BrowseSelection(field);
sel.Values = new string[] { v1, v2, v3 };
browseRequest.AddSelection(sel);
Dictionary<string, float> boostMap = new Dictionary<string, float>();
boostMap.Add(v1, b1);
boostMap.Add(v2, b2);
boostMap.Add(v3, b3);
// Add a custom scoring function factory that has the same scoring logic as Lucene.Net
BoboBrowse.Net.Query.Scoring.IFacetTermScoringFunctionFactory scoringFunctionFactory = CustomScoringFunctionFactory();
BoboBrowse.Net.Query.Scoring.FacetTermQuery resultQ = new BoboBrowse.Net.Query.Scoring.FacetTermQuery(sel, boostMap, scoringFunctionFactory);
browseRequest.Query = resultQ;
FacetSpec spec = new FacetSpec();
spec.MaxCount = 10;
browseRequest.SetFacetSpec(field, spec);
IBrowsable browser = new BoboBrowser(boboReader);
result = browser.Browse(browseRequest);
totalHits = result.NumHits;
}
// Lucene.
{
BrowseRequest browseRequest = new BrowseRequest();
browseRequest.Count = 10;
browseRequest.Offset = 0;
browseRequest.FetchStoredFields = true;
BooleanQuery resultQ = new BooleanQuery();
TermQuery tq = new TermQuery(new Term(field, v1));
tq.Boost = b1;
resultQ.Add(tq, Occur.SHOULD);
tq = new TermQuery(new Term(field, v2));
tq.Boost = b2;
resultQ.Add(tq, Occur.SHOULD);
tq = new TermQuery(new Term(field, v3));
tq.Boost = b3;
resultQ.Add(tq, Occur.SHOULD);
browseRequest.Query = resultQ;
// If you includ a FacetSpec, the facets will be ruturned
FacetSpec spec = new FacetSpec();
spec.MaxCount = 10;
browseRequest.SetFacetSpec(field, spec);
IBrowsable browser = new BoboBrowser(boboReader);
result2 = browser.Browse(browseRequest);
totalHits2 = result.NumHits;
}
from bobobrowse.net.
Closing this issue as a wontfix. As I mentioned, ToString should not be relied upon for testing purposes. It is there for informational/debugging purposes only. That said, there were several ToString fixes in the latest release, 3.2.2.
from bobobrowse.net.
Related Issues (20)
- MultiBoboBrowser HOT 1
- BrowseRequest.FetchStoredFields HOT 1
- BoboIndexReader.IsCurrent() HOT 1
- No need for cache warm-up for the system to perform HOT 1
- replace Common.Logging with LibLog HOT 1
- System.ArgumentOutOfRangeException HOT 1
- Empty BrowseHit array HOT 1
- NullReferenceException when parallel searching HOT 1
- .Net Core HOT 3
- Does bobobrowse cache the search result in anyway?
- Create a version without dependency on DLR to support Xamarin clients HOT 1
- How to get count of intersecting facet values?
- Nested Facet
- BoboIndexReader and IndexReader: can Bobo be used for simple text search, just like IndexReader?
- return a number of results for each facet
- Facet selection and ValueOperationAnd HOT 1
- Building the SearchIndex
- Where should I do the PR for upgrading mvc demo HOT 2
- Project status HOT 2
- BoboBrowse Custom Sort Field
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bobobrowse.net.