question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to get out filter ready categories/buckets

See original GitHub issue

@fergiemcdowall and @mewwts ! A JavaScript question from the semi illiterate. I’m looping and looping through a search result set to grab what I need for filtering. It seems it should be a better way. An example of what I have is this:

{
  "categories": [
    {
      "key": "ingredients",
      "value": [
        {
          "key": "sukker",
          "value": 365
        },
        {
          "key": "egg",
          "value": 291
        },
        {
          "key": "hvetemel",
          "value": 261
        },
        {
          "key": "bakepulver",
          "value": 198
        },
        {
          "key": "smør",
          "value": 198
        }
      ]
    }
  ]
}

And what I want from it is this:

[
  {
    "field": "ingredients",
    "gte": "sukker",
    "lte": "sukker"
  },
  {
    "field": "ingredients",
    "gte": "egg",
    "lte": "egg"
  },
  {
    "field": "ingredients",
    "gte": "hvetemel",
    "lte": "hvetemel"
  },
  {
    "field": "ingredients",
    "gte": "bakepulver",
    "lte": "bakepulver"
  },
  {
    "field": "ingredients",
    "gte": "smør",
    "lte": "smør"
  }
]

How is this best/simplest done? I’m doing this in the browser, and looking to browserify it later, so I would like to keep additional libraries out of it.

It’s for the norce-vuejs-app, so I need it to be general, working without knowing what the field is going to be.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
eklemcommented, Sep 30, 2016

No, I’m googling my eyes sore here, and hard when not knowing what to search for 😃 I’ll check that out! And thanks for the example, @meewts 👍

0reactions
eklemcommented, Oct 1, 2016

Sorry, got it working, @mewwts. “Move along! nothing to see here.”

Read more comments on GitHub >

github_iconTop Results From Across the Web

Guide to writing output filters - Apache HTTP Server Version 2.5
Output filters must be prepared to process buckets of non-standard types; with a few exceptions, a filter need not care about the types...
Read more >
Categorize Dimension Column Values into Buckets
In CRM Analytics, use a bucket column in a Data Prep recipe to categorize and organize text values. For example, you can create...
Read more >
Filtering catalog by non-anchor category throws "Bucket does ...
In the left column, click on the "Category" filter; Click on "Hoodies & Sweatshirts" to filter by it. Let me know if I...
Read more >
What is Bucket Field in Salesforce? Create and ... - Intellipaat
Step 4: Go to the left-aligned menu and click on the arrow near Columns and select 'Add Bucket Field' and double-click it. You...
Read more >
Bucketing in Looker - Google Cloud
You can enable or disable dimension fill by hovering over the dimension name in the Explore, clicking the field-level gear icon, and selecting...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found