This project is read-only.

Bad info on numeric facets

Apr 9, 2012 at 2:45 AM


I'm getting rare information on my Numeric facets.

Example: In my database i have recordsg grouped by a column. This are the records:

'Col A' Count
1 502
2 36
3 2216
4 806
5 172
6 17
7 6

So, my facet should return that values but returns this

1 (3755)
1 (3755)
1 (3755)
1 (3755)
1 (3755)
3 (2216)
4 (806)
1 (502)
5 (195)
5 (172)
2 (36)
6 (17)
7 (6)

The first record (with 3755) are the sum of the others (2216+806+502+195+172+36+17+6).

¿This is an error or I change my code?

  1 - This is how I generating my index:

Document document = new Document();
NumericField field;

field = new NumericField("Ambientes", 2, Field.Store.YES, true);
2 - This is how I add my facet
List<FacetHandler> facetHandler = new List<FacetHandler>();
FacetHandler facetHandlerItem = new MultiValueFacetHandler("XXX");
FacetSpec spec = new FacetSpec();
spec.MinHitCount = 1;
spec.OrderBy = FacetSpec.FacetSortSpec.OrderHitsD.SetFacetSpec(nombreFaceta, spec);
ICollection<FacetHandler> handlerList = facetHandler;

If instead of this, I use facetHandlerItem = new SimpleFacetHandler(nombreFaceta, new PredefinedTermListFactory<int>());
I only get one item instead of the seven items.



Apr 9, 2012 at 8:33 AM

Not sure why it is not working properly. Could you attach a minimized sample app with sources? I would like to debug it locally on my machine. 

Jan 2, 2015 at 9:23 PM
I know this is a late reply, but the NumericField is not supported by by BoboBrowse. According to the documentation here:
When being indexed, this field should not be tokenized. Furthermore, the values need to be formatted to ensure sorting by lexical order is the same as the value order.
Although it doesn't state it directly, formatting implies that the datatype of the Lucene field must be a string (that is, it should be Field, not NumericField).

I confirmed this by trying to use a numeric field in the Java version, which throws an exception:
F:\Projects\bobo-test>java -jar target\bobo-test-0.1.0.jar
Hello world!
Exception in thread "main" java.lang.NumberFormatException: For input string: "`
        at java.lang.NumberFormatException.forInputString(NumberFormatException.
        at java.lang.Integer.parseInt(
        at java.lang.Integer.parseInt(
        at com.browseengine.bobo.facets.impl.RangeFacetHandler.load(RangeFacetHa
        at com.browseengine.bobo.facets.impl.RangeFacetHandler.load(RangeFacetHa
        at com.browseengine.bobo.facets.FacetHandler.load(

        at com.browseengine.bobo.facets.FacetHandler.loadFacetData(FacetHandler.
        at com.browseengine.bobo.api.BoboIndexReader.loadFacetHandler(BoboIndexR
        at com.browseengine.bobo.api.BoboIndexReader.loadFacetHandlers(BoboIndex
        at com.browseengine.bobo.api.BoboIndexReader.facetInit(BoboIndexReader.j
        at com.browseengine.bobo.api.BoboIndexReader.facetInit(BoboIndexReader.j
        at com.browseengine.bobo.api.BoboIndexReader.facetInit(BoboIndexReader.j
        at com.browseengine.bobo.api.BoboIndexReader.getInstance(BoboIndexReader
        at com.browseengine.bobo.api.BoboIndexReader.getInstance(BoboIndexReader
        at bobo_test.HelloWorld.runBrowse(
        at bobo_test.HelloWorld.main(