Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

facets language #1

XULRunner42 opened this Issue Apr 20, 2012 · 3 comments


None yet
2 participants


I just found your refine-ruby gem and thanks! It's great!

I was wondering if you have any details or can point where I might look to find out about the language I must use to express and enforce that exports will act on my data facets... I found this line

'engine' => '{"facets":[],"mode":"row-based"}',

and I guess that must be where I add in my facets. I would like to know how to apply some simple facets, ideally at least facet by blank, and an example for at least one other customized facet. I thought this might be the same as GREL, but it seems it's not. I have checked out subversion trunk of Refine, is there a code file I should look at?

Thanks again!


I just found this. It seems to explain the language of facets, but what's missing?

Almost every expression described ends with plain English instructions, "and select 'true'" or "now select 'false'"

So, am I looking for something like: (??)

row.starred == true
(cells["First Name"].value[0] == cells["Last Name"].value[0])==true

Those are valid javascript expressions, they might work, I will get back to you.

I found http://code.google.com/p/google-refine/wiki/FacetedBrowsingArchitecture which shows some facets (they are JSON too) and suggests that you might want to trace the AJAX...

I got my facet's JSON from there, the AJAX trace in Google Chrome...

But, it doesn't seem to work. I made up a facet in the web interface, and tried adding the text of my new facet to 'engine' => '{"facets":[] ...

Then I found no records had been removed. I thought, "wait, I have to select the facet as false!"

Went back to the web interface, generated my facet again, selecting false this time, and tried adding this, the AJAX trace of the facet's JSON...

'engine' => '{"facets":[
{name: "Field To Filter", invert: false, expression: "isBlank(value)",
columnName: "Field To Filter", choices:[ {v:{v:true, l:true}, c: 2182, s: false},
{v:{v:false, l:false}, c:14085, s:true} ] ],"mode":"row-based"}',

... of course Field To Filter is the actual field's name, as it shows in the POST trace, which worked when it was sent by the browser environment into Google Refine, but it didn't work here. No records were removed. I tried quoting the key names as you did with {"facets":[]} but that did not help either.

So, I've learned a lot about Google Refine, but I still can't do scripted activities with facets. Where am I going wrong? Again the Wiki documentation just does not talk about choices. Their JSON from the link FacetedBrowsingArchitecture does not even include the choices array in the examples. I don't know if I am bound by those counts, or if they are checked against my data, or anything at all really.

I am totally mystified by the meaning of v, l, c, and s, although I've gathered that c stands for count, the rest of them to me might as well be spin, orbital, angular momentum... how do I choose a value for a facet? Help!


maxogden commented Apr 21, 2012

Hmm unfortunately I am not familiar with the faceting syntax, you'll want to ask one of the people on the Refine mailing list. If you copy paste your question from this thread here they should help you: https://groups.google.com/forum/?fromgroups#!forum/google-refine

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment