[Xapian-discuss] Usage of DateRangeValueProcessor

Arjen Smedes d.a.smedes at doubleforge.com
Mon Jul 11 20:37:10 BST 2011


Hi All,

After some ample trying and checking code, I'm stuck again. I can't get the
daterangevalue stuff to work. Here are some snippets of my problem:

1. class PortCallIndexer(Indexer):
    fields = [
        'estimated_date_of_arrival',
    ]

    tags = [
        ('eta', 'estimated_date_of_arrival'),
    ]

    def _get_query_parser(self, *args, **kwargs):

        query_parser = Indexer._get_query_parser(self, *args, **kwargs)
        query_parser.add_valuerangeprocessor(DateValueRangeProcessor(8,
"eta:"))

        return query_parser

2. some delve output:

Term List for record #1: 00 06 07 111 2011 4 CRN4 ETA00 ETA06 ETA07 ETA2011
SHIP111 SHIPwe UID-6-pm.PortCall-pm.index.portcallindexer we
Term List for record #2: 00 001 06 07 2 2011 23 CRN2 ETA00 ETA06 ETA07
ETA2011 ETD00 ETD06 ETD2011 ETD23 SHIP001 SHIPqq
UID-4-pm.PortCall-pm.index.portcallindexer qq
Term List for record #3: 01 04 07 08 17 19 2011 22 35 49 53 89 ATA01 ATA04
ATA07 ATA17 ATA2011 ATA49 ATD04 ATD08 ATD2011 ATD22 ATD35 ATD53 CRN19 SHIP89
SHIPuk UID-22-pm.PortCall-pm.index.portcallindexer uk
Term List for record #4: 00 01 06 1 2011 21 5 CRN5 ETA00 ETA01 ETA06 ETA2011
ETD00 ETD06 ETD2011 ETD21 SHIP1 SHIParjen
UID-7-pm.PortCall-pm.index.portcallindexer arjen
Term List for record #5: 03 07 125 18 2011 23 46 ATA03 ATA07 ATA2011 ATA23
ATA46 CRN18 SHIP125 SHIPuk UID-20-pm.PortCall-pm.index.portcallindexer uk
Term List for record #6: 1 89 CRN1 SHIP89 SHIPuk
UID-2-pm.PortCall-pm.index.portcallindexer uk
Term List for record #7: 00 001 01 02 06 14 15 2011 3 ATA00 ATA06 ATA14
ATA2011 ATD00 ATD06 ATD15 ATD2011 CRN3 ETA00 ETA01 ETA06 ETA2011 ETD00 ETD02
ETD06 ETD2011 SHIP001 SHIPqq UID-5-pm.PortCall-pm.index.portcallindexer qq
Term List for record #8: 00 06 123 2011 23 6 CRN6 ETA00 ETA06 ETA2011 ETA23
SHIP123 SHIPuk UID-8-pm.PortCall-pm.index.portcallindexer uk
Term List for record #9: 00 06 08 125 2011 8 CRN8 ETA00 ETA06 ETA08 ETA2011
SHIP125 SHIPuk UID-10-pm.PortCall-pm.index.portcallindexer uk
Term List for record #10: 00 06 15 2011 888 9 CRN9 ETA00 ETA06 ETA15 ETA2011
SHIP888 SHIPyy UID-11-pm.PortCall-pm.index.portcallindexer yy
Term List for record #11: 00 06 1 10 2011 22 CRN10 ETA00 ETA06 ETA2011 ETA22
SHIP1 SHIParjen UID-12-pm.PortCall-pm.index.portcallindexer arjen
Term List for record #12: 00 06 08 11 2011 CRN11 ETA00 ETA06 ETA08 ETA2011
SHIPklopjacht UID-13-pm.PortCall-pm.index.portcallindexer klopjacht
Term List for record #13: 125 7 CRN7 SHIP125 SHIPuk
UID-9-pm.PortCall-pm.index.portcallindexer uk
Term List for record #14: 13 CRN13 SHIPjaap
UID-15-pm.PortCall-pm.index.portcallindexer jaap
Term List for record #15: 12 CRN12 SHIPklopjacht
UID-14-pm.PortCall-pm.index.portcallindexer klopjacht
Term List for record #16: 14 89 CRN14 SHIP89 SHIPuk
UID-16-pm.PortCall-pm.index.portcallindexer uk
Term List for record #17: 125 16 CRN16 SHIP125 SHIPuk
UID-18-pm.PortCall-pm.index.portcallindexer uk
Term List for record #18: 1 15 CRN15 SHIP1 SHIParjen
UID-17-pm.PortCall-pm.index.portcallindexer arjen
Term List for record #19: 123 17 CRN17 SHIP123 SHIPuk
UID-19-pm.PortCall-pm.index.portcallindexer uk

3. I'd like to use the index to search for date-ranges. For examples, all
entries between 2011/06/01..2011/08/01, but I have tried a number of search
queries, none gives me what I need:

eta:2011/06/01..2011/08/04
eta:2011/06/01

etc, etc.

I'm sure I have missed an important point here, but in case I haven't: I
need help with this. The http://xapian.org/docs/valueranges is not extensive
enough here to help me out.

Thanks in advance.


More information about the Xapian-discuss mailing list