lbryio / lbry-sdk

The LBRY SDK for building decentralized, censorship resistant, monetized, digital content apps.
https://lbry.com
MIT License
7.19k stars 483 forks source link

ability to pass multiple time parameters (between case) on claim search #2787

Closed tzarebczan closed 2 years ago

tzarebczan commented 4 years ago

i.e. we should be able to pass a release time between two timestamps

jessopb commented 4 years ago

Query is handled in reader.py:

ops = {'<=': '__lte', '>=': '__gte', '<': '__lt', '>': '__gt'}
    for constraint in INTEGER_PARAMS:
        if constraint in constraints:
            value = constraints.pop(constraint)
            postfix = ''
            if isinstance(value, str):
                if len(value) >= 2 and value[:2] in ops:
                    postfix, value = ops[value[:2]], value[2:]
                elif len(value) >= 1 and value[0] in ops:
                    postfix, value = ops[value[0]], value[1:]
            if constraint == 'fee_amount':
                value = Decimal(value)*1000
            constraints[f'claim.{constraint}{postfix}'] = int(value)

What is a good notation for between?

Something like duration="<=>val1,val2" for between, inclusive?

Or is a list better? durations=[">=5000", "<10000"] ?

tzarebczan commented 2 years ago

Having duration ranges would be great, can this be bumped up?

tzarebczan commented 2 years ago

Also, having release time ranges would help with an upcoming odysee feature...

tzarebczan commented 2 years ago

This can be closed as implemented... Need to confirm hubs work nicely with it https://github.com/lbryio/lbry-sdk/blob/3e3974f81392ae2f95f20487ca08dd4ad2b62922/lbry/extras/daemon/daemon.py#L70