Coder Social home page Coder Social logo

Comments (11)

madelgi avatar madelgi commented on August 16, 2024

Hello @meyumeapps -- you can model the behavior of an implicit or selector like so:

Selector orTags = Selectors.tags("tag1", "tag2", "tag3");

Note that this will still be serialized as an explicit or selector, i.e.:

// Result after serialization
{
    "or": [
        {"tag": "tag1"},
        {"tag": "tag2"},
        {"tag": "tag3"},
    ]
}

Unfortunately, there is no analogous method for an "and" selector -- you must call Selectors.tag explicitly for each tag you wish to reference:

Selector andTags = Selectors.and(
    Selectors.tag("tag1"),
    Selectors.tag("tag2"),
    Selectors.tag("tag3")
);

from java-library.

madelgi avatar madelgi commented on August 16, 2024

Alternatively, if you know which tags you're sending to before constructing the request, you can define a segment and simply send to the segment:

Selector tagSegment = Selectors.segment("my-segment"); 

This will actually reduce the size of the payload, but it requires that you build the segment ahead of time.

from java-library.

meyumeapps avatar meyumeapps commented on August 16, 2024

Thanks @madelgi . Our tags are dynamic so I don't think the segment idea will work.

We are facing two problems:

  • more than 1000 tags
  • large message (> 2Mb)

Do you have any thoughts on how I can resolve these please?

from java-library.

madelgi avatar madelgi commented on August 16, 2024

Hi @meyumeapps, do you mind explaining what your use case is? 1000 tags is an enormous query, and it's possible we offer a tool (perhaps named users) that would be more suitable for accomplishing your goals.

There are a number of features we're trying to add to the java library right now, and I don't think we're going to get around to updating the serialization method for tags. However, we'd consider a patch if you want to submit something. Before that, though, we should see if there's is an implementation for your use case that doesn't use tags.

from java-library.

meyumeapps avatar meyumeapps commented on August 16, 2024

Sure, we send notifications for our weather sites. Each site has a unique id.

Users subscribe to receive notifications for a weather site e.g. their home location or perhaps where they work.

We have over 6,000 sites and therefore have to send a push notification for each affected site. For example, if there was a severe weather warning covering much of the UK then we would want to send a push to UA listing the affected sites. Each tag would be a site id.

from java-library.

madelgi avatar madelgi commented on August 16, 2024

Ah, interesting. This is a bit of an edge case, and I don't think our other features can help us out here. If you want to submit a PR that adds the implicit-or functionality, we'd be happy to review it. I'm sorry we couldn't help you more directly!

from java-library.

meyumeapps avatar meyumeapps commented on August 16, 2024

Will certainly look at submitting the PR.

However, can you tell me if we would still hit the 1000 tag limit with the implicit-or functionality ?

from java-library.

madelgi avatar madelgi commented on August 16, 2024

No such limit exists for the push API -- maybe you're thinking of the 1000 tag limit in place for segment creation?

Also, I'd recommend searching through or posting in the forums. You may be able to get additional help there.

from java-library.

meyumeapps avatar meyumeapps commented on August 16, 2024

This is the limit I was concerned about:

https://support.urbanairship.com/entries/109178196-What-are-the-limitations-to-the-Urban-Airship-Engage-API-

Have I misunderstood?

from java-library.

madelgi avatar madelgi commented on August 16, 2024

That limit is advised, but it's not enforced by the push API. If you exceed it, you shouldn't encounter an error.

from java-library.

meyumeapps avatar meyumeapps commented on August 16, 2024

Ah, excellent news, thank you 👍

from java-library.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.