19. Lucene ?
• Apache Lucene is a high-
performance, full-featured text
search engine library written
entirely in Java.
• Although Lucene provides the
ability to create your own queries
through its API, it also provides a
rich query language through the
Query Parser, a lexer which
interprets a string into a Lucene
Query using JavaCC.
• Source: Lucene.org
26. When a node is created,
the following actions take place
• Indexing of the whole
set of the items
properties
• Plain text Indexing of
the related content
27. When a node is created:
• The plain text indexing
takes place if the
content format is:
– Office (Open ou Microsoft)
– XML/HTML
– PDF
– Emails
– Texte
29. Have a look into the data model!
File : contentModel.xml
30. What does the
« tokenize »
principle mean?
File : contentModel.xml
31. Tokenising is to split
(or not) a word into
one or many key
words.
32. Example
Here is a PowerPoint presentation
regarding Alfresco and its search feature.
33. Without
« Tokenisation »…
t
t en
C onHere
is a PowerPoint presentation
regarding Alfresco and its search feature.
34. A copy of the whole
sentence is made in
the index
t
t en
C onHereis a PowerPoint presentation
regarding Alfresco and its search feature.
D EX
IN Here is a PowerPoint presentation
regarding Alfresco and its search feature.
35. The search would
then be done on the
whole sentence!
u
t en
C onHere
is a PowerPoint presentation
regarding Alfresco and its search feature.
D EX
IN Hereis a PowerPoint presentation
regarding Alfresco and its search feature.
36. However if the
sentence is split into
key words…
u
t en
C on Here is a PowerPoint presentation
regarding Alfresco and its search feature.
37. The serach can be
done on those key
words only!
u
t en
C on Here is a PowerPoint presentation
regarding Alfresco and its search feature.
D EX
IN Presentation,PowerPoint,
Alfresco, search
42. Lucene in Alfresco enables
you to query on
• The NodeRef (ID)
• The Type
Of a NODE!
• The Properties
• The Aspects Do you work for the
secret services ?
• The key Words
(Content)
52. Note
Lucene and Alfresco!
According to the Alfresco version you
are working with, you can get
completely different results than
those presented in here.
This is the magic of the search feature!
53. How to make a simple
query with Lucene
Connect as « admin » to
Alfresco
Click on
Choose the node browser
54. How to make a simple
query with Lucene
Choose the store :
workspace://SpacesStore
In the drop down list, choose
Lucene
68. Operators
+
To add a validated criteria
-
To add a non validated criteria
AND
To add a criteria
OR
To add a choice between several
criterias
NOT
To exclude a criteria
69. I want all the spaces with
the name « space »
TYPE:quot;cm:folderquot; AND @cm:name:quot;Spacequot;
TYPE:quot;cm:folderquot; +@cm:name:quot;Spacequot;
+TYPE:quot;cm:folderquot; AND @cm:name:quot;Spacequot;
72. I want all folders with the name
« space » which has a category
TYPE:quot;cm:folderquot;
AND @cm:name:quot;Spacequot;
AND ASPECT:quot;cm:generalclassifiablequot;
73. I want all spaces with the name
« space » which
DOES NOT have a category
TYPE:quot;cm:folderquot;
AND @cm:name:quot;Spacequot;
AND NOT ASPECT:quot;cm:generalclassifiablequot;
TYPE:quot;cm:folderquot;
+@cm:name:quot;Spacequot;
-ASPECT:quot;cm:generalclassifiablequot;
76. Note
Work Zone!
This section is
experimental and results
vary a lot according to
the tests!
77. To search for text properties, you
can use specific operators
78. Special Operators
?
Can replace one character
*
Can replace one or many
characters
79. I want all spaces with the name
starting with « spa »
TYPE:quot;cm:folderquot;
AND @cm:name:quot;Spa*quot;
TYPE:quot;cm:folderquot;
+@cm:name:quot;Spa*quot;
80. I want all spaces with the name
ending with « spa »
TYPE:quot;cm:folderquot;
AND @cm:name:quot;*acequot;
TYPE:quot;cm:folderquot;
+@cm:name:quot;*acequot;
81. Note
End of work zone!
This section was
experimental!
82. For more details…
Lucene WebSite
• http://lucene.apache.org/
• http://lucene.apache.org/java/docs/queryparsersyntax.html
Alfresco Wiki
• http://wiki.alfresco.com/wiki/Search#Lucene
• http://wiki.alfresco.com/wiki/Lucene
• http://wiki.alfresco.com/wiki/Lucene_Extensions_and_Issues
130. I want the child which has a description
« Space 1.1 Description » and that is of type
folder
descendant::*[@cm:description
='Space 1.1 Description' and
subtypeOf('cm:folder')]
131. I want the child which has its aspect related to
categories and is of type folder
descendant::*[hasAspect('cm:genera
lclassifiable') and
subtypeOf('cm:folder')]
132. To go further…
• Wikipedia [FR]
• W3Schools[ENG]
• Spécifications W3C : Xpath 1.0[ENG]
• Spécifications W3C : XPath 2.0[ENG]
• Developpez.com (A voir!)
133. I now have many nodes! But where
is Wally/Waldo…? Well actually…
where is the good node?
134. If you are looking for a node,
use the services…