Return-Path: X-Original-To: apmail-lucene-java-user-archive@www.apache.org Delivered-To: apmail-lucene-java-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 4AF0318E3D for ; Wed, 23 Dec 2015 18:30:24 +0000 (UTC) Received: (qmail 815 invoked by uid 500); 23 Dec 2015 18:30:22 -0000 Delivered-To: apmail-lucene-java-user-archive@lucene.apache.org Received: (qmail 764 invoked by uid 500); 23 Dec 2015 18:30:22 -0000 Mailing-List: contact java-user-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: java-user@lucene.apache.org Delivered-To: mailing list java-user@lucene.apache.org Received: (qmail 752 invoked by uid 99); 23 Dec 2015 18:30:21 -0000 Received: from Unknown (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 23 Dec 2015 18:30:21 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id 64BF8C3085 for ; Wed, 23 Dec 2015 18:30:21 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 3.148 X-Spam-Level: *** X-Spam-Status: No, score=3.148 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, HTML_MESSAGE=3, RCVD_IN_MSPIKE_H2=-0.001, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd1-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx1-us-east.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id hZAU_fsNp43A for ; Wed, 23 Dec 2015 18:30:20 +0000 (UTC) Received: from mail-qg0-f54.google.com (mail-qg0-f54.google.com [209.85.192.54]) by mx1-us-east.apache.org (ASF Mail Server at mx1-us-east.apache.org) with ESMTPS id 6A05742A46 for ; Wed, 23 Dec 2015 18:30:20 +0000 (UTC) Received: by mail-qg0-f54.google.com with SMTP id k90so159447103qge.0 for ; Wed, 23 Dec 2015 10:30:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=lJgAz3imed0nmmKq5RTeyqHc/7nX75pSJF3enVvsCFg=; b=WD/NOSTMd4qv/Q6L86EjxtqxayZMzZcv0bb7gYzfepbh1GWm/wYHbqPuWUr8v85CJW Cbbjzanc6/qpSedXH5czfrjb9tkCDO++J3gv1yGyjdr0ao17ICEWUg1kWEUyDIULgzLH t/OHj0kxbbe9FDzrqF9YJIbKaO/KCud3vIn7sRsRSk+XVPutWYZmrz7YpDPPC6h3imvT ob7+hKD2iSIfYaK0sY6/veAcLozx+kQR84ayCRZPC4Pr6YWHNeIW6JqaLNGc1YYKTEqo aiai3XwfG6URc+eWpMHmRWwADQ8F4zFRYQ7BwE8oGTEZavealybe4084C1VC6WF/tsCy B9nQ== MIME-Version: 1.0 X-Received: by 10.140.88.51 with SMTP id s48mr41050591qgd.48.1450895420213; Wed, 23 Dec 2015 10:30:20 -0800 (PST) Received: by 10.55.146.133 with HTTP; Wed, 23 Dec 2015 10:30:20 -0800 (PST) Date: Wed, 23 Dec 2015 13:30:20 -0500 Message-ID: Subject: problem with payload retrieval in custom query - lucene 5.3.1 From: Bob Price To: java-user@lucene.apache.org Content-Type: multipart/alternative; boundary=001a11c11e7620d34c052794eac0 --001a11c11e7620d34c052794eac0 Content-Type: text/plain; charset=UTF-8 Via elasticsearch 2.1 we have written a custom Lucene TokenFilter that adds a payload to a special term during indexing analysis, and we also have custom Lucene Query/Weight/Scorer classes that compare this payload against some query data to decide if a document matches a query or not. I know that the payloads are being written as desired since I can easily see them via elasticsearch's termvector API. However, while our Scorer can see all of the documents with this special term, I can never get access to its payload. The approach to doing this in the Scorer is simply: docs = leafReaderContext.reader().postings(specialTerm, PostingsEnum.PAYLOADS); Then, walking through the docs via nextDoc() and trying to retrieve each doc's payload via: BytesRef payloadRef = docs.getPayload(); if (payloadRef != null) { byte[] payload = payloadRef.bytes; } I have logging in place so that I see that every document I have in a test index is being looked at, but for every document, the payloadRef comes back null. What am I doing wrong? Is there some setting I need to enable somewhere to allow the postings method to do what it says it can do? Is there a better way to do this? Any advice would be appreciated! Bob --001a11c11e7620d34c052794eac0--