[ 
https://issues.apache.org/jira/browse/SOLR-5809?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Jan Mach updated SOLR-5809:
---------------------------

    Description: 
There is a strange behavior, when I use attributes for the same tag in multiple 
fields or I would like to select the same tag in xpath.

My XML looks like:

<?xml version="1.0" encoding="utf-8"?>
<metadata>
  <id>1</id>

  <fileProperties fileType="a">a.pdf</fileProperties>
  <fileProperties fileType="b">b.pdf</fileProperties>
  <fileProperties fileType="c">c.pdf</fileProperties>
</metadata>

What works fine:
  <field column="test_value"    xpath="/metadata/fileProperties" 
multiValued="true" />
  <field column="test_fileType" xpath="/metadata/fileProperties/@fileType" 
multiValued="true" />
The result: 
  test_value="a.pdf","b.pdf","c.pdf"  (correct)
  test_fileType="a","b","c"                (correct)
  
What is wrong 1):
When I add a new column with selecting by an attribute, test_value and 
test_fileType have wrong values.
  <field column="test_fileID"   
xpath="/metadata/fileProperties[@fileType='a']/@fileType" />
  <field column="test_value"    xpath="/metadata/fileProperties" />
  <field column="test_fileType" xpath="/metadata/fileProperties/@fileType" />
The result:
  test_fileID="a"  (correct)
  test_value="b","c"  (missing "a")
  test_fileType="b.pdf","c.pdf"  (missing "a.pdf")  


What is wrong 2):
  I cannot select the same field value twice.
  <field column="test_one"       xpath="/metadata/fileProperties" 
multiValued="true"/>
  <field column="test_two"       xpath="/metadata/fileProperties]" 
multiValued="true"/>
The result:
  test_one:                           (the field is missing, should be 
"a.pdf","b.pdf","c.pdf")
  test_two: "a.pdf","b.pdf","c.pdf"   (correct)  


  was:
There is a strange behavior, when I use attributes for the same tag in multiple 
fields or I would like to select the same tag in xpath.

My XML looks like:

<?xml version="1.0" encoding="utf-8"?>
<metadata>
  <id>1</id>

  <fileProperties fileType="a">a.pdf</fileProperties>
  <fileProperties fileType="b">b.pdf</fileProperties>
  <fileProperties fileType="c">c.pdf</fileProperties>
</metadata>

What works fine:
  <field column="test_value"    xpath="/metadata/fileProperties" 
multiValued="true" />
  <field column="test_fileType" xpath="/metadata/fileProperties/@fileType" 
multiValued="true" />
The result: 
  test_value="a","b","c"  (correct)
  test_fileType="a.pdf","b.pdf","c.pdf"  (correct)
  
What is wrong 1):
When I add a new column with selecting by an attribute, test_value and 
test_fileType have wrong values.
  <field column="test_fileID"   
xpath="/metadata/fileProperties[@fileType='a']/@fileType" />
  <field column="test_value"    xpath="/metadata/fileProperties" />
  <field column="test_fileType" xpath="/metadata/fileProperties/@fileType" />
The result:
  test_fileID="a"  (correct)
  test_value="b","c"  (missing "a")
  test_fileType="b.pdf","c.pdf"  (missing "a.pdf")  


What is wrong 2):
  I cannot select the same field value twice.
  <field column="test_one"       xpath="/metadata/fileProperties" 
multiValued="true"/>
  <field column="test_two"       xpath="/metadata/fileProperties]" 
multiValued="true"/>
The result:
  test_one:                           (the field is missing, should be 
"a.pdf","b.pdf","c.pdf")
  test_two: "a.pdf","b.pdf","c.pdf"   (correct)  



> Problem with xpath and attributes
> ---------------------------------
>
>                 Key: SOLR-5809
>                 URL: https://issues.apache.org/jira/browse/SOLR-5809
>             Project: Solr
>          Issue Type: Bug
>          Components: contrib - DataImportHandler
>    Affects Versions: 4.6
>            Reporter: Jan Mach
>            Priority: Critical
>   Original Estimate: 24h
>  Remaining Estimate: 24h
>
> There is a strange behavior, when I use attributes for the same tag in 
> multiple fields or I would like to select the same tag in xpath.
> My XML looks like:
> <?xml version="1.0" encoding="utf-8"?>
> <metadata>
>   <id>1</id>
>   <fileProperties fileType="a">a.pdf</fileProperties>
>   <fileProperties fileType="b">b.pdf</fileProperties>
>   <fileProperties fileType="c">c.pdf</fileProperties>
> </metadata>
> What works fine:
>   <field column="test_value"    xpath="/metadata/fileProperties" 
> multiValued="true" />
>   <field column="test_fileType" xpath="/metadata/fileProperties/@fileType" 
> multiValued="true" />
> The result: 
>   test_value="a.pdf","b.pdf","c.pdf"  (correct)
>   test_fileType="a","b","c"                (correct)
>   
> What is wrong 1):
> When I add a new column with selecting by an attribute, test_value and 
> test_fileType have wrong values.
>   <field column="test_fileID"   
> xpath="/metadata/fileProperties[@fileType='a']/@fileType" />
>   <field column="test_value"    xpath="/metadata/fileProperties" />
>   <field column="test_fileType" xpath="/metadata/fileProperties/@fileType" />
> The result:
>   test_fileID="a"  (correct)
>   test_value="b","c"  (missing "a")
>   test_fileType="b.pdf","c.pdf"  (missing "a.pdf")  
> What is wrong 2):
>   I cannot select the same field value twice.
>   <field column="test_one"       xpath="/metadata/fileProperties" 
> multiValued="true"/>
>   <field column="test_two"       xpath="/metadata/fileProperties]" 
> multiValued="true"/>
> The result:
>   test_one:                           (the field is missing, should be 
> "a.pdf","b.pdf","c.pdf")
>   test_two: "a.pdf","b.pdf","c.pdf"   (correct)  



--
This message was sent by Atlassian JIRA
(v6.2#6252)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org

Reply via email to