You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by neman ould sidahmed <no...@yahoo.fr> on 2009/03/02 11:08:41 UTC
custom indexing for jackrabbit
Hello everybody,
I have a problem with configuration indexing for Jackrabbit, I declared my custom nodes types,
I have a node type name mynamespace:item, I would like indexing some
properties like title, autho rfor this node type this is my
configuration :
- repsotiroy configuration for search indexing :
<SearchIndex class="org.apache.jackrabbit.core.query.lucene.SearchIndex">
<param name="path" value="${rep.home}/repository/index"/>
<param name="indexingConfiguration" value="${rep.home}/jackrabbit-indexing.xml"/>
<param name="textFilterClasses"
value="org.apache.jackrabbit.extractor.MsWordTextExtractor,org.apache.jackrabbit.extractor.MsExcelTextExtractor,org.apache.jackrabbit.extractor.MsPowerPointTextExtractor,org.apache.jackrabbit.extractor.PdfTextExtractor,org.apache.jackrabbit.extractor.OpenOfficeTextExtractor,org.apache.jackrabbit.extractor.RTFTextExtractor,org.apache.jackrabbit.extractor.HTMLTextExtractor,org.apache.jackrabbit.extractor.XMLTextExtractor"/>
<param name="extractorPoolSize " value="2"/>
<param name="supportHighlighting" value="true"/>
<param name="forceConsistencyCheck" value="false"/>
<param name="enableConsistencyCheck" value="false"/>
</SearchIndex>
- my file indexing configuration :
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE configuration SYSTEM "http://jackrabbit.apache.org/dtd/indexing-configuration-1.1.dtd">
<configuration xmlns:nt="http://www.jcp.org/jcr/nt/1.0"
xmlns:mynamespace="http://www.mydomain.fr/jcr/mynamespace"
xmlns:jcr="http://www.jcp.org/jcr/1.0">
<index-rule nodeType="mynamespace:item">
<property boost="5.0">mynamespace:title</property>
<property boost="1.5">mynamespace:author</property>
</index-rule>
</configuration>
- my file nodes types configuration
<?xml version="1.0" encoding="UTF-8"?>
<nodeTypes xmlns:fn="http://www.w3.org/2005/xpath-functions"
xmlns:fn_old="http://www.w3.org/2004/10/xpath-functions"
xmlns:jcr="http://www.jcp.org/jcr/1.0"
xmlns:mix="http://www.jcp.org/jcr/mix/1.0"
xmlns:nt="http://www.jcp.org/jcr/nt/1.0"
xmlns:rep="internal"
xmlns:mynamespace="http://www.mydomain.fr/jcr/mynamespace"
xmlns:sv="http://www.jcp.org/jcr/sv/1.0"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<nodeType hasOrderableChildNodes="false" isMixin="false" name="mynamespace:item" primaryItemName="">
<supertypes>
<supertype>mix:referenceable</supertype>
<supertype>nt:base</supertype>
</supertypes>
<propertyDefinition autoCreated="false" mandatory="false"
multiple="true" name="mynamespace:author" onParentVersion="COPY"
protected="false" requiredType="String"/>
<propertyDefinition autoCreated="false" mandatory="false"
multiple="false" name="mynamespace:title" onParentVersion="COPY"
protected="false" requiredType="String"/>
<propertyDefinition autoCreated="false" mandatory="false"
multiple="false" name="mynamespace:subject" onParentVersion="COPY"
protected="false" requiredType="String"/>
<propertyDefinition autoCreated="false" mandatory="true"
multiple="false" name="mynamespace:dateCreated" onParentVersion="COPY"
protected="false" requiredType="Date"/>
</nodeType>
</nodeTypes>
for registry Namespaces :
session.getWorkspace().getNamespaceRegistry().registerNamespace(ns, uri);
for Nodestypes register :
InputStream xml = new FileInputStream(this.typesDefinition.getFile());
Workspace workspace = (Workspace) session.getWorkspace();
NodeTypeManager ntMgr = workspace.getNodeTypeManager();
NodeTypeRegistry ntReg = ((NodeTypeManagerImpl) ntMgr).getNodeTypeRegistry();
NodeTypeDef[] types = NodeTypeReader.read(xml);
for (int j = 0; j < types.length; j++) {
NodeTypeDef def = types[j];
try {
ntReg.getNodeTypeDef(def.getName());
}
catch (NoSuchNodeTypeException nsne) {
logger.info("Registering node "+def.getName());
// HINT: if not already registered than register custom node type
ntReg.registerNodeType(def);
}
}
if I delete my file indexing configuration this work else if I update
the item for type mynamespace:item I can't get it it deleted from index, please, can any one tell me why?
regards
nould
Re: custom indexing for jackrabbit
Posted by Marcel Reutegger <ma...@gmx.net>.
Hi,
On Mon, Mar 2, 2009 at 13:56, neman ould sidahmed <no...@yahoo.fr> wrote:
> I get my item with the quer
>
> "select * from mynamespace:item where mynamespace:title = 'nould' "
> the title is unique.
>
> ok, I get my item, I update for example the title for this item and I save the session, the new
> value of title is 'nould1'.
>
> I do the same query, with new tilte, the new query is :
> "select * from mynamespace:item where mynamespace:title = 'nould1' "
> the query for that item does not return anymore?
>
> If I check with XPath qury, I got the item. I think the problem is the re-index of this item.
Whether you use SQL or XPath is just a syntactical difference but does
not change the way how items are indexed or queried. If it works with
XPath, then something must be wrong with your SQL statement.
regards
marcel
Re: custom indexing for jackrabbit
Posted by neman ould sidahmed <no...@yahoo.fr>.
I get my item with the quer
"select * from mynamespace:item where mynamespace:title = 'nould' "
the title is unique.
ok, I get my item, I update for example the title for this item and I save the session, the new
value of title is 'nould1'.
I do the same query, with new tilte, the new query is :
"select * from mynamespace:item where mynamespace:title = 'nould1' "
the query for that item does not return anymore?
If I check with XPath qury, I got the item. I think the problem is the re-index of this item.
can anyone tell me why?
--- En date de : Lun 2.3.09, Marcel Reutegger <ma...@gmx.net> a écrit :
De: Marcel Reutegger <ma...@gmx.net>
Objet: Re: custom indexing for jackrabbit
À: users@jackrabbit.apache.org, nouldsid@yahoo.fr
Date: Lundi 2 Mars 2009, 13h43
Hi,
On Mon, Mar 2, 2009 at 12:52, neman ould sidahmed <no...@yahoo.fr>
wrote:
> The problem is if I update my item, I lose the item, why?
what exactly does that mean? do you mean a query for that item does
not return it anymore? are there any exceptions that are thrown? If
you do a query, how does the query look like?
regards
marcel
Re: custom indexing for jackrabbit
Posted by Marcel Reutegger <ma...@gmx.net>.
Hi,
On Mon, Mar 2, 2009 at 12:52, neman ould sidahmed <no...@yahoo.fr> wrote:
> The problem is if I update my item, I lose the item, why?
what exactly does that mean? do you mean a query for that item does
not return it anymore? are there any exceptions that are thrown? If
you do a query, how does the query look like?
regards
marcel
Re: custom indexing for jackrabbit
Posted by neman ould sidahmed <no...@yahoo.fr>.
Hi,
tank for your response,
but, the SearchIndex element from the
workspace.xml is exactly the SearchIndex element from the repository.xml.
The problem is if I update my item, I lose the item, why?
if I re-index the data without indexconfiguration, I got my item,
I update the item, I got it whitout problem.
I think the problem is the file jackrabbit-indexing.xml, but it's like
the conf in the wiki!!!
I hope it's clear.
The searchIndex element in workspace.xml :
<!-- Search index and the file system it uses.
class: FQN of class implementing the QueryHandler interface -->
<SearchIndex class="org.apache.jackrabbit.core.query.lucene.SearchIndex">
<param name="path" value="${wsp.home}/index"/>
<param name="indexingConfiguration" value="${rep.home}/jackrabbit-indexing.xml"/>
<param name="textFilterClasses"
value="org.apache.jackrabbit.extractor.MsWordTextExtractor,org.apache.jackrabbit.extractor.MsExcelTextExtractor,org.apache.jackrabbit.extractor.MsPowerPointTextExtractor,org.apache.jackrabbit.extractor.PdfTextExtractor,org.apache.jackrabbit.extractor.OpenOfficeTextExtractor,org.apache.jackrabbit.extractor.RTFTextExtractor,org.apache.jackrabbit.extractor.HTMLTextExtractor,org.apache.jackrabbit.extractor.XMLTextExtractor"/>
<param name="extractorPoolSize " value="2"/>
<param name="supportHighlighting" value="true"/>
<param name="forceConsistencyCheck" value="false"/>
<param name="enableConsistencyCheck" value="false"/>
</SearchIndex>
regards
nould
--- En date de : Lun 2.3.09, Marcel Reutegger <ma...@gmx.net> a écrit :
De: Marcel Reutegger <ma...@gmx.net>
Objet: Re: custom indexing for jackrabbit
À: users@jackrabbit.apache.org
Date: Lundi 2 Mars 2009, 12h01
Hi,
On Mon, Mar 2, 2009 at 11:08, neman ould sidahmed <no...@yahoo.fr>
wrote:
> <SearchIndex
class="org.apache.jackrabbit.core.query.lucene.SearchIndex">
> <param name="path"
value="${rep.home}/repository/index"/>
> <param name="indexingConfiguration"
value="${rep.home}/jackrabbit-indexing.xml"/>
> <param name="textFilterClasses"
value="org.apache.jackrabbit.extractor.MsWordTextExtractor,org.apache.jackrabbit.extractor.MsExcelTextExtractor,org.apache.jackrabbit.extractor.MsPowerPointTextExtractor,org.apache.jackrabbit.extractor.PdfTextExtractor,org.apache.jackrabbit.extractor.OpenOfficeTextExtractor,org.apache.jackrabbit.extractor.RTFTextExtractor,org.apache.jackrabbit.extractor.HTMLTextExtractor,org.apache.jackrabbit.extractor.XMLTextExtractor"/>
> <param name="extractorPoolSize "
value="2"/>
> <param name="supportHighlighting"
value="true"/>
> <param name="forceConsistencyCheck"
value="false"/>
> <param name="enableConsistencyCheck"
value="false"/>
> </SearchIndex>
this looks like the SearchIndex element for the version store in the
repository.xml. Did you change the workspace.xml files accordingly as
well? If you did, please post the SearchIndex element from the
workspace.xml.
furthermore, what's the exact error you see?
regards
marcel
Re: custom indexing for jackrabbit
Posted by Marcel Reutegger <ma...@gmx.net>.
Hi,
On Mon, Mar 2, 2009 at 11:08, neman ould sidahmed <no...@yahoo.fr> wrote:
> <SearchIndex class="org.apache.jackrabbit.core.query.lucene.SearchIndex">
> <param name="path" value="${rep.home}/repository/index"/>
> <param name="indexingConfiguration" value="${rep.home}/jackrabbit-indexing.xml"/>
> <param name="textFilterClasses"
value="org.apache.jackrabbit.extractor.MsWordTextExtractor,org.apache.jackrabbit.extractor.MsExcelTextExtractor,org.apache.jackrabbit.extractor.MsPowerPointTextExtractor,org.apache.jackrabbit.extractor.PdfTextExtractor,org.apache.jackrabbit.extractor.OpenOfficeTextExtractor,org.apache.jackrabbit.extractor.RTFTextExtractor,org.apache.jackrabbit.extractor.HTMLTextExtractor,org.apache.jackrabbit.extractor.XMLTextExtractor"/>
> <param name="extractorPoolSize " value="2"/>
> <param name="supportHighlighting" value="true"/>
> <param name="forceConsistencyCheck" value="false"/>
> <param name="enableConsistencyCheck" value="false"/>
> </SearchIndex>
this looks like the SearchIndex element for the version store in the
repository.xml. Did you change the workspace.xml files accordingly as
well? If you did, please post the SearchIndex element from the
workspace.xml.
furthermore, what's the exact error you see?
regards
marcel