Hi abhayd,

XPathEntityProcessor does only support a subset of xpath,
like div[@id="2"] but not [id=2]
Take a look to
https://issues.apache.org/jira/browse/SOLR-1437#commentauthor_12756469_verbose

I solve this problem by using xslt a preprocessor (with full xpath).

The drawback is performance "wasting": See
http://lucene.472066.n3.nabble.com/DIH-Enhance-XPathRecordReader-to-deal-with-body-FLATTEN-true-and-body-h1-td2799005.html

Best regards
  Karsten

-------- Original-Nachricht --------
> Datum: Mon, 1 Aug 2011 23:21:45 -0700 (PDT)
> Von: abhayd <ajdabhol...@hotmail.com>
> An: solr-user@lucene.apache.org
> Betreff: xpath expression not working

> hi 
> I have a xml doc whichi would like to index using xpath entity processor.
> <add>
> <doc>
>  <id>1</id>
>  <details>xyz</details>
> </doc>
> <doc>
>  <id>2</id>
>  <details>xyz2</details>
> </doc>
> </add>
> 
> if i want to just load document with id=2 how would that work? 
> 
> I tried xpath expression that works with xpath tools but not in solr. 
> 
> <dataConfig>
>     <dataSource type="FileDataSource" />
>     <document>
>         <entity name="f" processor="FileListEntityProcessor"
> baseDir="c:\temp" fileName="promotions.xml" 
>                 recursive="false" rootEntity="false" dataSource="null">
>             <entity name="x" processor="XPathEntityProcessor"
> forEach="/add/doc" url="${f.fileAbsolutePath}" pk="id">
>                 <field column="id" xpath="/add/doc/[id=2]/id"/>
>             </entity>
>         </entity>
>     </document>
> </dataConfig>
> 
> Any help how i can do this?
> 
> --
> View this message in context:
> http://lucene.472066.n3.nabble.com/xpath-expression-not-working-tp3218133p3218133.html
> Sent from the Solr - User mailing list archive at Nabble.com.

Reply via email to