You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by manju16832003 <ma...@gmail.com> on 2013/05/13 04:24:00 UTC

Re: MultiValue

Hi All,
I wanted to achieve something similar

[ { "last_name" : "jain", "training_skill":["c", "c++", "php,java,.net"] }] 

[{"person_id" : "111", "documents" :
["doc_1","doc_2","doc_3","doc4,doc5,doc6"]}]
Meaning one person could have more than one document.

how do we need to write the query, and configure data fields.

My current data-config.xml is
<dataConfig>
       <dataSource type="JdbcDataSource" name="ds-carlist"
driver="com.mysql.jdbc.Driver" url="jdbc:mysql://127.0.0.1/solr_db"
user="root" password="root"/>

	<document name="person">
	 <entity name="list" dataSource="ds-person" query="SELECT a.id,b.docs FROM
person as a,docs as b
WHERE a.id = b.person_id">

	 </entity>
	</document>
</dataConfig>

and data field declearion in schema.xml is
   <field name="id" type="int" indexed="true" stored="true"
required="true"/> 
   <field name="docs" type="string" indexed="true" stored="true"
multiValued="true"/>


Currently I don't see any errors and the no output. 
I'm bit confused how to configure above scenario in Solr.

Thank you



--
View this message in context: http://lucene.472066.n3.nabble.com/MultiValue-tp4034305p4062788.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: MultiValue

Posted by manju16832003 <ma...@gmail.com>.
Hi All,
I managed to *solve* the issue I had posted earlier with respect to
multiValued.

Here is the Query suppose to configured this way in *data-config.xml *
Description: in the below, first query has associated table images. Each
person would have many images. Here the JSON/XML would return all the images
associated with the person in block.

<document name="manju">
	  <entity name="list" dataSource="manjudb" query="select
member_id,MemberName FROM member">
		<entity name="imagelist" dataSource="manjudb" query="SELECT imagepath FROM
images WHERE member_id='${list.member_id}'">
		</entity>
	  </entity>
</document>

and *schema.xml* for the above query fields looks like

<field name="member_id" type="int" indexed="true" stored="true"
required="true"/> 
<field name="MemberName" type="string" indexed="true" stored="true"/>
<field name="imagepath" type="string" indexed="true" stored="true"
<b>multiValued="true"* />

Output:
"response": {
    "numFound": 3,
    "start": 0,
    "docs": [
      {
        "MemberName": "Vettel",
        "member_id": 1,
        "_version_": 1434904021528739800
      },
      {
        "MemberName": "Schumacher",
        "member_id": 2,
        "imagepath": [ //As you could see here that Three rows from the
table *images* returned as one JSON object.
          "c:\\\\images\\etc\\test.jpg",
          "c:\\\\images\\etc\\test211.jpg",
          "c:\\\\images\\etc\\test2343434.jpg",
          "C:\\\\manju"
        ],
        "_version_": 1434904021541322800
      },
      {
        "MemberName": "J.Button",
        "member_id": 3,
        "_version_": 1434904021543420000
      }
    ]
  }
}

Thanks






--
View this message in context: http://lucene.472066.n3.nabble.com/MultiValue-tp4034305p4062863.html
Sent from the Solr - User mailing list archive at Nabble.com.