filters syntax / options?

markguertinmarkguertin Member Posts: 61
Hi folks, can't seem to find this anywhere in the documentation.

I'm looking to do some more advanced filtering and I can't seem to find anything that allows me to use more regex type options .. for example what I would like to be able to do is something like this:

lsserver.search.filters.product_class LIKE '(01 %|02 %|03 %|10 %)'

Is there anywhere that documents the different options we have available when using these filters?  So far all I can really figure out what works manually is  < > = and CONTAINS.  None of these seem to give me any regex-ish or other options for more complex queries.

Is anything like this possible?

4 comments

  • markguertinmarkguertin Member Posts: 61
    Another obligatory poke to see if anyone is out there or listening ... it's been almost a week. I feel like this is a ghost town at this point.  Maybe I'm the only one doing advanced integrations out there?
  • gregaricangregarican Member Posts: 333 
    At least is the Lightspeed Retail API world, I've found limited ability to narrow down the scope of my result set. I wind up pulling a larger set and then have to apply logic to the set in order to actually get my desired results. Not sure about Lightspeed E-com...
  • jamesratcliffejamesratcliffe Administrator, Lightspeed Staff Posts: 160 moderator
    @gregarican That's not really on topic for this discussion.

    @markguertin Not very many OnSite integration developers have discovered the forums yet, unfortunately.

    The filter using NSPredicate-style strings. This page covers it pretty well (although some of the info there is specific implementation in Objective-C): https://nshipster.com/nspredicate/#basic-comparisons

    For a regular expression match, use 'MATCH':
    lsserver.search.filters.class MATCHES "(01 .*|02 .*|03 .*|10 .*)"
    The 'LIKE' operator works more like it does in SQL, but with different wildcards:
    lsserver.search.filters.class LIKE "01 *" OR lsserver.search.filters.class LIKE "02 *" OR lsserver.search.filters.class LIKE "02 *" OR …
    James Ratcliffe
    Lightspeed HQ
  • markguertinmarkguertin Member Posts: 61
    Thanks @jamesratcliffe

    I ended up doing longer monolithic ones for now (like your second example) but it's good to know what options are available going forward.  The documentation is lacking in that area (and out of date currently!)... would be great if that was documented somewhere online so that we can see the kinds of filtering available.
Sign In or Register to comment.