Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Search within json document in apache solr lucene

below is the json sample i have imported to solr where id is unique and json_doc field contains whole json.

{ "id" : "cust_123", "json_doc" : "{ "\first_name\":\"xyz\", \"last_name\":\"ABC\", \"address\":\"#s3,Apple store,New York,USA}\" }" }

Now i want to search within the json document like Apple store as query or New york as query or USA .... and i should get the document ...

Want help to define schema.xml for this kind of request.

if you use space tokenizer then it will tokenize on space ... so if i will search for "apple store" then it will not match ....

Please help me

like image 905
Mayur Kataria Avatar asked Apr 17 '12 12:04

Mayur Kataria


1 Answers

Here's how to index JSON documents: http://wiki.apache.org/solr/UpdateJSON

And here's how to get search results in a JSON doc: http://wiki.apache.org/solr/SolJSON

If you, on the other hand, have some weird requirement to store the whole document in a single field please tell...

like image 62
Marko Bonaci Avatar answered Oct 12 '22 23:10

Marko Bonaci