You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by Esteban Franqueiro <es...@bea.com> on 2008/01/23 16:17:51 UTC

Fields and Lucene

Hi all.
I have the following code that used to work in 1.3
Document doc = hits.doc(i);
String name = doc.get(FieldNames.LABEL);
Now with Jackrabbit 1.4 I get a null label. Digging, I saw that when it reads the fields from the 
index, there's no label.
Was there any change between 1.3 and 1.4 regarding the fields in a Lucene QueryHits result?
Or do I need to add the label somwhere, so I can later get it?
Regards,

Esteban Franqueiro
esteban.franqueiro@bea.com


Notice:  This email message, together with any attachments, may contain information  of  BEA Systems,  Inc.,  its subsidiaries  and  affiliated entities,  that may be confidential,  proprietary,  copyrighted  and/or legally privileged, and is intended solely for the use of the individual or entity named in this message. If you are not the intended recipient, and have received this message in error, please immediately return this by email and then delete it.

Re: Fields and Lucene

Posted by Esteban Franqueiro <es...@bea.com>.
> Hi again.
>
>> Well, the signature of the SearchIndex createDocument changed. I also
>> use a different SearchIndex which extends o.a.j SearchIndex. If you do
>> so, make sure you make use of @Override java 1.5 features to avoid basic
>> problems you have now with changing signatures over overridden classes.
>> I know for sure IndexFormatVersion has been added to the signature.
>
> I didn't notice the signature change. Now I have updated that, but it still is not called.
> I set my search index in the SearchIndex element within the Workspace element, and it doesn't work
> (doesn' call my code). If I also set it in the SearchIndex element of Repository, it now calls my
> code, but the results are not as expected.
> So my question is how to correctly set the repository.xml's SearchIndex elements to be able to use
> my own searh index impl.

Sorry for the trouble, I found a bug in my code. I don't fully understand the behavior I got, but 
now it works.
Thanks!

Esteban Franqueiro
esteban.franqueiro@bea.com 


Notice:  This email message, together with any attachments, may contain information  of  BEA Systems,  Inc.,  its subsidiaries  and  affiliated entities,  that may be confidential,  proprietary,  copyrighted  and/or legally privileged, and is intended solely for the use of the individual or entity named in this message. If you are not the intended recipient, and have received this message in error, please immediately return this by email and then delete it.

Re: Fields and Lucene

Posted by Esteban Franqueiro <es...@bea.com>.
Hi again.

> Well, the signature of the SearchIndex createDocument changed. I also
> use a different SearchIndex which extends o.a.j SearchIndex. If you do
> so, make sure you make use of @Override java 1.5 features to avoid basic
> problems you have now with changing signatures over overridden classes.
> I know for sure IndexFormatVersion has been added to the signature.

I didn't notice the signature change. Now I have updated that, but it still is not called.
I set my search index in the SearchIndex element within the Workspace element, and it doesn't work 
(doesn' call my code). If I also set it in the SearchIndex element of Repository, it now calls my 
code, but the results are not as expected.
So my question is how to correctly set the repository.xml's SearchIndex elements to be able to use 
my own searh index impl.
Regards,

Esteban Franqueiro
esteban.franqueiro@bea.com 


Notice:  This email message, together with any attachments, may contain information  of  BEA Systems,  Inc.,  its subsidiaries  and  affiliated entities,  that may be confidential,  proprietary,  copyrighted  and/or legally privileged, and is intended solely for the use of the individual or entity named in this message. If you are not the intended recipient, and have received this message in error, please immediately return this by email and then delete it.

RE: Fields and Lucene

Posted by Ard Schrijvers <a....@hippo.nl>.
Hello,

> Hi Ard.
> Thanks for you responses. I've done a little more digging and 
> I see that my app uses a different SearchIndex to override 
> the NodeIndexer class. This NodeIndexer just adds a few more 
> properties to the index. What I noticed is that, even though 
> I have the search index element in the workspace.xml pointing 
> to the right class, my NodeIndexer.createDoc() is not being 
> called. Instead it calls Jackrabbit's default NodeIndexer method.
> My class' constructor is actually being called during 
> RepositoryImpl's constructor, but when it's time to index the 
> docs, MultiIndex calls to the default SearchIndex.
> Any ideas? This used to work in Jackrabbit 1.3.

Well, the signature of the SearchIndex createDocument changed. I also
use a different SearchIndex which extends o.a.j SearchIndex. If you do
so, make sure you make use of @Override java 1.5 features to avoid basic
problems you have now with changing signatures over overridden classes.
I know for sure IndexFormatVersion has been added to the signature. 

Anyway, it shouldn't be to hard to find it now,

Regards Ard  

> Regards,
> 
> Esteban Franqueiro
> esteban.franqueiro@bea.com 
> 
> 
> Notice:  This email message, together with any attachments, 
> may contain information  of  BEA Systems,  Inc.,  its 
> subsidiaries  and  affiliated entities,  that may be 
> confidential,  proprietary,  copyrighted  and/or legally 
> privileged, and is intended solely for the use of the 
> individual or entity named in this message. If you are not 
> the intended recipient, and have received this message in 
> error, please immediately return this by email and then delete it.
> 

Re: Fields and Lucene

Posted by Esteban Franqueiro <es...@bea.com>.
Hi Ard.
Thanks for you responses. I've done a little more digging and I see that my app uses a different 
SearchIndex to override the NodeIndexer class. This NodeIndexer just adds a few more properties to 
the index. What I noticed is that, even though I have the search index element in the workspace.xml 
pointing to the right class, my NodeIndexer.createDoc() is not being called. Instead it calls 
Jackrabbit's default NodeIndexer method.
My class' constructor is actually being called during RepositoryImpl's constructor, but when it's 
time to index the docs, MultiIndex calls to the default SearchIndex.
Any ideas? This used to work in Jackrabbit 1.3.
Regards,

Esteban Franqueiro
esteban.franqueiro@bea.com 


Notice:  This email message, together with any attachments, may contain information  of  BEA Systems,  Inc.,  its subsidiaries  and  affiliated entities,  that may be confidential,  proprietary,  copyrighted  and/or legally privileged, and is intended solely for the use of the individual or entity named in this message. If you are not the intended recipient, and have received this message in error, please immediately return this by email and then delete it.

Re: Fields and Lucene

Posted by Jukka Zitting <ju...@gmail.com>.
Hi,

On Jan 24, 2008 12:19 PM, Ard Schrijvers <a....@hippo.nl> wrote:
> hard to say. We work with multiple people on the codebase. We make sure
> unit tests keep working and jsr specifications keep being implemented
> correct. How the index is structured is irrelevant (if you use
> Jackrabbit correctly). It will be restructured in the future again
> probably. You just should not rely on it

Exactly. I would also suggest that discussion about the implementation
details like the index structure be taken to the dev@ list.

BR,

Jukka Zitting

RE: Fields and Lucene

Posted by Ard Schrijvers <a....@hippo.nl>.
Hello,

> Certainly.
> How was the index restructured?

hard to say. We work with multiple people on the codebase. We make sure
unit tests keep working and jsr specifications keep being implemented
correct. How the index is structured is irrelevant (if you use
Jackrabbit correctly). It will be restructured in the future again
probably. You just should not rely on it

> 
> > OTOH, i might be off, and you mean something else? However, if you 
> > programm agains the lucene structure, make sure it is part of the 
> > structure which you control yourself. Otherwise you'll end up 
> > refactoring after every change
> 
> I don't know if the app is coded against the Lucene structure 
> (I'm not sure because I'm very new to this code), but my 
> problem is that it's asking for the label and the label is 
> not there. I'm trying to figure out how to make it add the 
> label, or why it's not there anymore.
> Any help is welcomed.

You might want to mail the relevant code part, but cannot promise
anything. Furthermore, you might want to checkout luke and look for the
difference in lucene index structure for 1.3 and 1.4, but I don't think
it will be easy, certainly not when you have little experience with it,

Regards Ard


Re: Fields and Lucene

Posted by Esteban Franqueiro <es...@bea.com>.
Hi Ard.

> I am not sure about your particular issue, but the Lucene indexing
> structure changed yes (and will keep changing in the future). But
> apparently you have been programming against how this lucene index is
> structured. You hooked this in yourself I suppose?

I have to maintain this code, but I did not originally write it. And for the time being, I can't 
change it, all I can do is upgrade it to use Jackrabbit 1.4.

> Jackrabbit, just like specified in jsr 170, gives you a subset of xpath
> and sql as possible ways to query the repository data. Since this is an
> abstraction, people do not have to know how to write lucene queries *or*
> hoe the lucene index is structured. If from 1.3 -> 1.4 the lucene index
> is restructured, well, that is obviously possible. We can not guarantuee
> obviously that programming against assumptions made about how the index
> is structured keeps working. Hopefully you agree on this with me.

Certainly.
How was the index restructured?

> OTOH, i might be off, and you mean something else? However, if you
> programm agains the lucene structure, make sure it is part of the
> structure which you control yourself. Otherwise you'll end up
> refactoring after every change

I don't know if the app is coded against the Lucene structure (I'm not sure because I'm very new to 
this code), but my problem is that it's asking for the label and the label is not there. I'm trying 
to figure out how to make it add the label, or why it's not there anymore.
Any help is welcomed.
Regards,

Esteban Franqueiro
esteban.franqueiro@bea.com 


Notice:  This email message, together with any attachments, may contain information  of  BEA Systems,  Inc.,  its subsidiaries  and  affiliated entities,  that may be confidential,  proprietary,  copyrighted  and/or legally privileged, and is intended solely for the use of the individual or entity named in this message. If you are not the intended recipient, and have received this message in error, please immediately return this by email and then delete it.

RE: Fields and Lucene

Posted by Ard Schrijvers <a....@hippo.nl>.
Hello Esteban,

I am not sure about your particular issue, but the Lucene indexing
structure changed yes (and will keep changing in the future). But
apparently you have been programming against how this lucene index is
structured. You hooked this in yourself I suppose?

Jackrabbit, just like specified in jsr 170, gives you a subset of xpath
and sql as possible ways to query the repository data. Since this is an
abstraction, people do not have to know how to write lucene queries *or*
hoe the lucene index is structured. If from 1.3 -> 1.4 the lucene index
is restructured, well, that is obviously possible. We can not guarantuee
obviously that programming against assumptions made about how the index
is structured keeps working. Hopefully you agree on this with me. 

OTOH, i might be off, and you mean something else? However, if you
programm agains the lucene structure, make sure it is part of the
structure which you control yourself. Otherwise you'll end up
refactoring after every change

-Ard

> Hi all.
> I have the following code that used to work in 1.3 Document 
> doc = hits.doc(i); String name = doc.get(FieldNames.LABEL); 
> Now with Jackrabbit 1.4 I get a null label. Digging, I saw 
> that when it reads the fields from the index, there's no label.
> Was there any change between 1.3 and 1.4 regarding the fields 
> in a Lucene QueryHits result?
> Or do I need to add the label somwhere, so I can later get it?
> Regards,
> 
> Esteban Franqueiro
> esteban.franqueiro@bea.com
> 
> 
> Notice:  This email message, together with any attachments, 
> may contain information  of  BEA Systems,  Inc.,  its 
> subsidiaries  and  affiliated entities,  that may be 
> confidential,  proprietary,  copyrighted  and/or legally 
> privileged, and is intended solely for the use of the 
> individual or entity named in this message. If you are not 
> the intended recipient, and have received this message in 
> error, please immediately return this by email and then delete it.
>