Developer forum

Forum » CMS - Standard features » No FacetOptions when using parameter of type System.Int32

No FacetOptions when using parameter of type System.Int32

Kim Søjborg Pedersen
Reply

I'm trying to set up my facets, like I use to do.

But this time I have some facets with Query Parameter set to a parameter of the System.Int32, and one those the Facetoptions loop is alway empty.

could use help to move on, thanks.


Replies

 
Nicolai Pedersen
Reply

We would love to help - but I think that requires a bit more information of your setup to be able to detect what could be the issue.

Can you post some screendumps of your setup or provide a link?

BR Nicolai

 
Kim Søjborg Pedersen
Reply

Hi Nicolai, here is my POC where I try different things on my ProductCategory Field of type Integer.

The dw version is 8.7.2.13 

2016-10-07_1327.png 2016-10-07_1328.png 2016-10-07_1328_001.png 2016-10-07_1329.png 2016-10-07_1329_001.png 2016-10-07_1332.png
 
Kim Søjborg Pedersen
Reply

 <p>@GetLoop("FacetGroups").Count</p>

    foreach (var fg in GetLoop("FacetGroups"))
    {
        @fg.GetLoop("Facets").Count

        foreach (var item in fg.GetLoop("Facets"))
        {
            <h4>@item.GetString("Facet.Name")</h4>
            <select>
                @foreach (var itemOption in item.GetLoop("FacetOptions"))
                {
                <option>@itemOption.GetString("FacetOption.Value")</option>
                }
            </select>
        }
    }

 
Nicolai Pedersen
Reply

Hi Kim

Try to remove the "Stored" checkbox from the field definition.

Nicolai

 
Kim Søjborg Pedersen
Reply

Hi Nicolai,

No difference, I also tryed to take the field directly from the productfield, but its the same, no facets.

One more thing, on my query I found out that I can only use "Equal" and "Between" on Int32 and Int32[]. I have a need to use "Greater Then Or Equal" and "Less Than Or Equal". I hope you can help finding a solution on this. Thanks.

 
Nicolai Pedersen
Reply

Hi Kim

I need a URL to take a closer look. Otherwise it will be "It works on my machine" answer...

You can combine an equal and greater than in a group using or.

 
Kim Søjborg Pedersen
Reply

i'll be back when i have a test environment for you to see, today or tomorrow.

Kim

 
Kim Søjborg Pedersen
Reply

Hi Nicolai, No test enviroment yet, but I found the same issue on the vine website you sent to me long time ago. The productfield "Wine Enthusiast" as int i never renderet as a facet

 
Nicolai Pedersen
Reply

ok, but send me the URL to check it out once you have.

Attached my configuration and data...

Capture.PNG Capture1.PNG Capture2.PNG
 
Kim Søjborg Pedersen
Reply

yes I see your configuration, but the different is that your product customfield is a string type, try with a customfileld of type int.

- But good to see how to do it the other way around, I'm gonna need that too :)

 
Nicolai Pedersen
Reply

Yes, it also works.

Capture.PNG Capture1.PNG Capture2.PNG Capture3.PNG
 
Kim Søjborg Pedersen
Reply

yes but its still not the same setup as mine, because you convert it to a string and then you can't use greater than or less than I guess, and I have a need to do that.

 
Nicolai Pedersen
Reply
This post has been marked as an answer

Hi Kim

Yes - it is because how Lucene works. When you index Integers, they are not indexed on their exact value as you would read them. Lucene stores terms, and a term when dealing with nummeric values is not a number, but something else (some weird structure) so you don't get one value in the term index for each number, but something clever that Lucene can use when making range queries etc - kind of complicated to explain, but you can read more here: http://lucene.apache.org/core/4_2_0/core/org/apache/lucene/document/IntField.html.

But that means that when we apply a facet on top of this, we get some byte stuff out of the index, and that does not deserialize to something that can be shown.

So - storing the integer value as a string is the only option.

Of course our UI should probably reflect this limitation. Hope this clarifies a bit.

BR Nicolai

Votes for this answer: 1

 

You must be logged in to post in the forum