Take a look at PayloadTermQuery, I think that should give you some
hints.

Best,
Erick

On Fri, Jul 4, 2014 at 8:19 AM, Ranjith Venkatesan
<ranjit...@zohocorp.com> wrote:
> Hi all,
>
> I am evaluating Payload of lucene. I am using solr4.7.2 for this. I could
> able to index with payload, but i couldnt able to retrieve payload from
> DocsAndPositionsEnum. It is returning just null. But terms.hasPayloads() is
> returning true. And i can able to see payload value in luke (image attached
> below).
>
> I have following schema for payload field ,
>
> *schema.xml*
>    <field name="payloads" type="payloads" indexed="true" stored="true"/>
>      <fieldtype name="payloads" stored="false" indexed="true"
> class="solr.TextField" >
>       <analyzer>
>         <tokenizer class="solr.WhitespaceTokenizerFactory"/>
>          <filter class="solr.DelimitedPayloadTokenFilterFactory"
> encoder="float"/>
>       </analyzer>
>     </fieldtype>
>
> *My indexing code,*
>
> for(int i=1;i<=1000;i++)
> {
>         SolrInputDocument doc1= new SolrInputDocument();
>         doc1.addField("id", "test:"+i);
>         doc1.addField("uid", ""+i);
>         doc1.addField("payloads", "_UID_|"+i+"f");
>         doc1.addField("content", "test");
>
>         server.add(doc1);
>         if(i%10000 == 0)
>         {
>                 server.commit();
>         }
> }
>
> server.commit();
>
> *Search code :*
> DocsAndPositionsEnum termPositionsEnum =
> solrSearcher.getAtomicReader().termPositionsEnum(t);
> int doc = -1;
>
> while((doc = termPositionsEnum.nextDoc()) !=
> DocsAndPositionsEnum.NO_MORE_DOCS)
> {
>         System.out.println(termPositionsEnum.getPayload()); // returns null
> }
>
>
> *luke *
> <http://lucene.472066.n3.nabble.com/file/n4145641/luke.png>
>
> Am i missing some configuration or i am doing in a wrong way ??? Any help in
> resolving this issue will be appreciated.
>
> Thanks in advance
>
> Ranjith Venkatesan
>
>
>
> --
> View this message in context: 
> http://lucene.472066.n3.nabble.com/Solr-4-7-Payload-tp4145641.html
> Sent from the Solr - User mailing list archive at Nabble.com.

Reply via email to