Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [CDO] Query & Lucene(Required: Indexing attributes of the object based on the annotations in the model.)
[CDO] Query & Lucene [message #997327] Sun, 06 January 2013 01:36 Go to next message
Mixa Alekseev is currently offline Mixa AlekseevFriend
Messages: 10
Registered: February 2011
Junior Member
Required: Indexing attributes of the object based on the annotations in the model.

How it can be implemented?


Sorry for my bad English.
Re: [CDO] Query & Lucene [message #997647 is a reply to message #997327] Sun, 06 January 2013 07:15 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 5590
Registered: July 2009
Senior Member
Am 06.01.2013 02:36, schrieb Mixa Alekseev:
> Required: Indexing attributes of the object based on the annotations in the model.
>
> How it can be implemented?
With Lucene.
Re: [CDO] Query & Lucene [message #997926 is a reply to message #997647] Wed, 09 January 2013 02:13 Go to previous messageGo to next message
Mixa Alekseev is currently offline Mixa AlekseevFriend
Messages: 10
Registered: February 2011
Junior Member
Eike Stepper wrote on Sun, 06 January 2013 02:15
Am 06.01.2013 02:36, schrieb Mixa Alekseev:
> How it can be implemented?
With Lucene.


Yes.

I look at the implementation *cdo.server.security
May be used for these purposes WriteAccessHandler to add, remove indexes?

As far as it is correct?


Sorry for my bad English.
Re: [CDO] Query & Lucene [message #997970 is a reply to message #997926] Wed, 09 January 2013 05:03 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 5590
Registered: July 2009
Senior Member
Am 09.01.2013 03:13, schrieb Mixa Alekseev:
> I look at the implementation *cdo.server.security
> May be used for these purposes WriteAccessHandler to add, remove indexes?
Yes, that would be possible. Or, if you don't need to veto commits you can also use the newer (and higher-level)
CDOCommitInfoProvider.addCommitInfoHandler(CDOCommitInfoHandler) like this:

repository.getCommitInfoManager().addCommitInfoHandler(new LuceneHandler());

Please note that IRepository.getCommitInfoManager() was missing for a while, so, depending on your CDO installation you
may need to use:

((InternalRepository)repository).getCommitInfoManager().addCommitInfoHandler(new LuceneHandler());

To make the Lucene index infos available to clients I would implement an IQueryHandler and contribute it to the repository.

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
Re: [CDO] Query & Lucene [message #997973 is a reply to message #997970] Wed, 09 January 2013 05:17 Go to previous messageGo to next message
Mixa Alekseev is currently offline Mixa AlekseevFriend
Messages: 10
Registered: February 2011
Junior Member
Thanks!

Sorry for my bad English.
Re: [CDO] Query & Lucene [message #998120 is a reply to message #997970] Wed, 09 January 2013 12:08 Go to previous messageGo to next message
Christophe Bouhier is currently offline Christophe BouhierFriend
Messages: 937
Registered: July 2009
Senior Member
Hi Eike,

Is this just an idea you have now, thinking out loud, or has it been done like this before? If so, can we get our hands on the code?

I looked at Lucene, it looks pretty much geard towards indexing text, but with EMF models it doesn't seem to have value. (Ok, I didn't dive deep into it, so perhaps I am talking bullocks).

I ended, building an index, which simply listens for invalidations and available server side only. What I needed to index is feature paths.

So i.e. Path 1: Object1.featureX -> Object2.featureY -> Object3.featureY , and simply serialized it as a String and put in a Hashmap with the string as the Key and the CDOID of the last object in the path as the value. A query does a text lookup on the String. Would Lucene add some value to this concept?

Cheers Christophe

[Updated on: Wed, 09 January 2013 12:08]

Report message to a moderator

Re: [CDO] Query & Lucene [message #998131 is a reply to message #998120] Wed, 09 January 2013 12:24 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 5590
Registered: July 2009
Senior Member
Am 09.01.2013 13:08, schrieb Christophe Bouhier:
> Hi Eike,
> Is this jus an idea you have now, thinking out loud, or has it been done like this before? If so, can we get our hands
> on the code?
I haven't done it, nor do I know that someone else has done it. But I've thought a couple times about it ;-)

> I looked at Lucene, it looks pretty much geard towards indexing text, but with EMF models it doesn't seem to have value.
Well there are EDataTypes that do provide text, e.g., EString. I could well imagine model annotations that specify
extraction rules or configure extractor instances per package, class, feature or data type.

> (Ok, I didn't dive deep into it, so perhaps I am talking bullocks).
> I ended, building an index, which simply listens for invalidations and available server side only.
Yes.

> What I needed to index is feature paths.
I'd call those ESettings ;-)

> So i.e. Path 1: Object1.featureX -> Object2.featureY -> Object3.featureY , and simply serialized it as a String and
> put in a Hashmap with the string as the Key and the CDOID of the last object in the path as the value. A query does a
> text lookup on the String. Would Lucene add some value to this concept?
Certainly!

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
Re: [CDO] Query & Lucene [message #998135 is a reply to message #998131] Wed, 09 January 2013 12:32 Go to previous messageGo to next message
Christophe Bouhier is currently offline Christophe BouhierFriend
Messages: 937
Registered: July 2009
Senior Member
euh... ESettings? Let me look in the EMF bible for this... Can you plz elaborate a little bit on what Lucene would add to the concept of ESettings (or EFeaturePaths, this term I steel from EMF Databinding).
Re: [CDO] Query & Lucene [message #998147 is a reply to message #998135] Wed, 09 January 2013 12:48 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 5590
Registered: July 2009
Senior Member
Am 09.01.2013 13:32, schrieb Christophe Bouhier:
> euh... ESettings?
I really meant org.eclipse.emf.ecore.EStructuralFeature.Setting.

> Let me look in the EMF bible for this...
Nah, the source code is your friend :P

> Can you plz elaborate a little bit on what Lucene would add to the concept of ESettings
It wouldn't add something. But Lucene could store FK infos in an indexed document that we could use to reconstruct
EStructuralFeature.Settings

> (or EFeaturePaths, this term I steel from EMF Databinding).
I'm not a DB guru but it strikes me that such an EFeaturePath is a purely static contruct, i.e., it only refers to the
meta model, not to an EObject. I may be wrong, though.

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
Re: [CDO] Query & Lucene [message #1000239 is a reply to message #998147] Mon, 14 January 2013 10:34 Go to previous messageGo to next message
Mixa Alekseev is currently offline Mixa AlekseevFriend
Messages: 10
Registered: February 2011
Junior Member
Hi All!

My current problem: mapping many-valued feature on Lucene (Multi-field)

Several solutions:
1) use multi document mapping, for example:
Doc
field cdoId
field attr_Name
field attr_Index
(not effective)

2) use attribute postfix in name, for example:
field cdoId
field attr:index
(does not work, because CDOClearFeatureDelta not suport "size")

3) delete|create document
(CDORevisionDelta can not cast to InternalCDORevision)


Sorry for my bad English.
Re: [CDO] Query & Lucene [message #1000254 is a reply to message #1000239] Mon, 14 January 2013 11:14 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 5590
Registered: July 2009
Senior Member
Am 14.01.2013 11:34, schrieb Mixa Alekseev:
> Hi All!
>
> My current problem: mapping many-valued feature on Lucene (Multi-field)
Please ask Lucene questions on some Lucene forum.

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper


>
> Several solutions:
> 1) use multi document mapping, for example:
> Doc
> field cdoId
> field attr_Name
> field attr_Index
> (not effective)
>
> 2) use attribute postfix in name, for example:
> field cdoId
> field attr:index
> (does not work, because CDOClearFeatureDelta not suport "size")
>
> 3) delete|create document
> (CDORevisionDelta can not cast to InternalCDORevision)
Re: [CDO] Query & Lucene [message #1000538 is a reply to message #1000254] Tue, 15 January 2013 00:29 Go to previous message
Mixa Alekseev is currently offline Mixa AlekseevFriend
Messages: 10
Registered: February 2011
Junior Member
Ok! Only CDO API...

Context: CDOCommitInfoHandler#handleCommitInfo(CDOCommitInfo)
CDOCommitInfo have getNewObjects which cast to InternalCDORevision
CDOCommitInfo have getChangedObjects without capabilities cast to InternalCDORevision

My spherical vacuum problem case need only "ChangedObjects" without FeatureDeltas
the similarity InternalCDORevision.getValue(feature)

Thanks!


Sorry for my bad English.

[Updated on: Tue, 15 January 2013 00:43]

Report message to a moderator

Previous Topic:Loading Resource from EMF generated Plugin
Next Topic:[CDO-Net4j]
Goto Forum:
  


Current Time: Sat Dec 20 06:47:27 GMT 2014

Powered by FUDForum. Page generated in 0.02409 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software