Johan Haest
Johan Haest

Reputation: 4431

Lucene.net and relational data searching

I have the following situation:

I have a person with default fields like: Name, FirstName, Phone, Email, ...

A person has many languageskills, the languageskill entity has the following fields: Language, Speaking, Writing, Understanding, Mothertongue

A person has many workexperiences, with fields: Office, Description, Period, Location

How would I index something like this with Lucene.net?

The following searches could be possible:

 - FirstName:"Arno" AND LanguageSkill:(Language:"Dutch" AND Speaking:[3 TO 5])
 - FirstName:"Arno" AND WorkExperience:(Description:"Marketing")
 - FirstName:"Arno" AND WorkExperience:(Description:"Marketing" OR Description:"Sales")
 - FirstName:"Arno" AND WorkExperience:(Description:"Programmer") AND LanguageSkill:(Language:"English" AND Speaking:[3 TO 5] AND MotherTongue:"true")

Would something like this be possible in Lucene, I've tried flattening my relations already where a document could look like this:

Name:"Stallen"
FirstName:"Arno"
WorkExperience:"Office=Lidl Description=Sales Location=London"
WorkExperience:"Office=Abro Description=Programmer Location=London"
LanguageSkill:"Language=Dutch Speaking=3 Writing=1 Understanding=3"
LanguageSkill:"Language=Egnlish Speaking=5 Writing=4 Understanding=5 MotherTongue=true"

Upvotes: 0

Views: 286

Answers (2)

Johan Haest
Johan Haest

Reputation: 4431

I ended up using the Java version of Lucene (3.6) which contains parent child documents. I used IKVM to generate the .net DLL out of it.

Upvotes: 1

L.B
L.B

Reputation: 116178

"if all you have is a hammer, everything looks like a nail"

Your requirements suit better to relational databases. I would go that way since I don't see anything related with free text search

However if you have to use Lucene.Net you should flatten your data a little bit more such as

Name:"Stallen"
FirstName:"Arno"
WorkExperienceDescription:Sales
WorkExperienceLocation:London
LanguageSkillLanguage:Dutch
LanguageSkillLanguage:English

Of course this would result in some info loss and you would not be able to make a search like

FirstName:"Arno" AND LanguageSkill:(Language:"Dutch" AND Speaking:[3 TO 5])

PS: You can use the same fieldname (ex., LanguageSkillLanguage) multiple times in a single document.

Upvotes: 1

Related Questions