Cloud Photo

Azure Data Architect | DBA

Quick Tip: Indexing Nested Objects in CouchDB-Lucene

As part of a proof-of-concept for a bill-of-materials (BOM) explosion database in CouchDB, I used CouchDB-Lucene. Here are a few quick screenshots of how I got it to work. I will fill in the details in a future post.The sample document format shows an “item” that is made up of several “components” that are identified by a “part_number” and a “part_name.”

Sample Document Format
Sample Document Format

 

Next, here is the text of the index function used to index the items with components and each component’s parts details.

Lucene Function to Index Component Arrays
Lucene Function to Index Component Arrays

 

Finally, the search results from the following URL:

http://127.0.0.1:5984/_fti/local/bulk/_design/lucene/parts?q=part_name:in*&force_json=true&include_docs=true

Search Results
Search Results

Leave a Reply