Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Hibernate Search in Action - application of 'Fieldable' lazy field

 
Dinesh Sundrani
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So I have a trade order execution system where the stock order once executed and confirmed, the complete order.xml is stored in an Oracle DB as a BLOB field. Now I have 2 fields which I need to index and search on: 1. The OrderId numeric field and the BLOB order.xml field.

Does Hibernate Search custom field bridge and a Lucene Fieldable lazy field implementation help in such a case to read the xml tags, extract the CDATA text and index on those words so as to become easier to be searchable by Broker Name, Customer Name, CUSIP Id, Stock Ticker, etc�
 
Emmanuel Bernard
author
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
Yes this is totally possible.
Your custom bridge will read and part the XML and put the attributes you want into the Lucene Document under the Fields you want.

Typically you will ahve something like that

public class Trade {
@Id @DocumentId Integer orderId;

@Field(bridge=@FieldBridge(impl=OrderXMLIndexer.class)
@Lob
byte[] orderXml;
}

OrderXMLIndexer will manipulate the Lucene Document and add fields to it:
- orderXml.brokerName
- orderXml.customerName
- ...

Note that the field name is customizable, Particularly, you do not have to prefix them by the property name (orderXml) though it is recommended.

Your Lucene query will look like
"orderXml.brokerName:Merril"
 
Dinesh Sundrani
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bingoooo !!! That's really what I was looking for..

"orderXML.brokerName:MER"
"orderXML.brokerName:LEH"
"orderXML.brokerName:GS"
"orderXML.protfolioName:JeffersonCharitableTrust"
"orderXML.sellRecommendation:BUY"
"orderXML.ratingAgency:Fitch"


 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic