151
Search Tutorial What is this flower ?

Alfresco in few points - Search Tutorial

Embed Size (px)

Citation preview

Page 1: Alfresco in few points - Search Tutorial

Search Tutorial

What is this flower ?

Page 2: Alfresco in few points - Search Tutorial

This represents Alfresco !

Page 3: Alfresco in few points - Search Tutorial

An ECM Open Source Solution

Page 4: Alfresco in few points - Search Tutorial

Where is the Problem ?

Page 5: Alfresco in few points - Search Tutorial

Curious people who want to understand Alfresco…

Page 6: Alfresco in few points - Search Tutorial

With lots of questions…(To express…)

Page 7: Alfresco in few points - Search Tutorial

A possible solution…

Page 8: Alfresco in few points - Search Tutorial

Simply a presenter with presentations about Alfresco

Page 9: Alfresco in few points - Search Tutorial

with a few answers… (To verify)

Page 10: Alfresco in few points - Search Tutorial

Let’s do it !

Page 11: Alfresco in few points - Search Tutorial

But before starting, here is a reminder !

Page 12: Alfresco in few points - Search Tutorial

The principle is…Everything is a NODE!

I am a beautiful node!

Page 13: Alfresco in few points - Search Tutorial

The rule is…Alfresco provides

services to manage Nodes

Even I have a manager…

Page 14: Alfresco in few points - Search Tutorial

Now let’s go!

Page 15: Alfresco in few points - Search Tutorial

As far as I understand, different language can be possibly used

to do searches…

Page 16: Alfresco in few points - Search Tutorial

Indeed!Let’s have a look…

Page 17: Alfresco in few points - Search Tutorial

XPath

Lucene

Page 18: Alfresco in few points - Search Tutorial

Lucene first!

Page 19: Alfresco in few points - Search Tutorial

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

Page 20: Alfresco in few points - Search Tutorial

And with Alfresco… How does it work?

Page 21: Alfresco in few points - Search Tutorial

Put in a nutshell…

Page 22: Alfresco in few points - Search Tutorial

1. Collect

PropertiesAspect

Key words

ID

Type

Page 23: Alfresco in few points - Search Tutorial

2. Preserve

Properties

Aspect

Key words

IDType

Page 24: Alfresco in few points - Search Tutorial

3. Use

Properties

Key wordsAspect

Page 25: Alfresco in few points - Search Tutorial

To push further…

Page 26: Alfresco in few points - Search Tutorial

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

Page 27: Alfresco in few points - Search Tutorial

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

Page 28: Alfresco in few points - Search Tutorial

To check it…

Page 29: Alfresco in few points - Search Tutorial

Have a look into the data model!

File : contentModel.xml

Page 30: Alfresco in few points - Search Tutorial

File : contentModel.xml

What does the « tokenize »

principle mean?

Page 31: Alfresco in few points - Search Tutorial

Tokenising is to split (or not) a word into

one or many key words.

Page 32: Alfresco in few points - Search Tutorial

Here is a PowerPoint presentation regarding Alfresco and its search feature.

Example

Page 33: Alfresco in few points - Search Tutorial

Here is a PowerPoint presentation regarding Alfresco and its search feature.

Without « Tokenisation »…

Content

Page 34: Alfresco in few points - Search Tutorial

Here is a PowerPoint presentation regarding Alfresco and its search feature.

A copy of the whole sentence is made in

the index

Here is a PowerPoint presentation regarding Alfresco and its search feature.

INDEX

Content

Page 35: Alfresco in few points - Search Tutorial

Here is a PowerPoint presentation regarding Alfresco and its search feature.

The search would then be done on the

whole sentence!

Here is a PowerPoint presentation regarding Alfresco and its search feature.

INDEX

Contenu

Page 36: Alfresco in few points - Search Tutorial

Here is a PowerPoint presentation regarding Alfresco and its search feature.

However if the sentence is split into

key words…

Contenu

Page 37: Alfresco in few points - Search Tutorial

Here is a PowerPoint presentation regarding Alfresco and its search feature.

The serach can be done on those key

words only!

Presentation, PowerPoint, Alfresco, search

INDEX

Contenu

Page 38: Alfresco in few points - Search Tutorial

So don’t forget to check your data

model !

Page 39: Alfresco in few points - Search Tutorial
Page 40: Alfresco in few points - Search Tutorial

OK… Demo time!

Page 41: Alfresco in few points - Search Tutorial

A bit of theory

Page 42: Alfresco in few points - Search Tutorial

Lucene in Alfresco enables you to query on

Do you work for the secret services ?

• The NodeRef (ID) The NodeRef (ID)

• The TypeThe Type

• The PropertiesThe Properties

• The AspectsThe Aspects

• The key Words The key Words (Content)(Content)

Of a NODE!Of a NODE!

Page 43: Alfresco in few points - Search Tutorial

TheQueries

Page 44: Alfresco in few points - Search Tutorial

To query on the Noderef

What is the interest of searching for a node we

already know the name of???

ID:" <Mon NodeRef> "ID:" <Mon NodeRef> "

Page 45: Alfresco in few points - Search Tutorial

To query on the Type

Hopefully you remember what’s the QName…

TYPE:" <TypeQName> "TYPE:" <TypeQName> "

Otherwise click here

Page 46: Alfresco in few points - Search Tutorial

To query on a property

Why is it different than the other queries??

@<QNamePropriété>\:" Value "@<QNamePropriété>\:" Value "

Why is it not upper case ?

Page 47: Alfresco in few points - Search Tutorial

To query on an Aspect

AAhh! That’s better!

ASPECT:" <AspectQName> "ASPECT:" <AspectQName> "

Page 48: Alfresco in few points - Search Tutorial

To query on a key word included in the content of

the node

Okey… Understood!

TEXT:<value>TEXT:<value>

I am getting bored…

Page 49: Alfresco in few points - Search Tutorial

Context

Page 50: Alfresco in few points - Search Tutorial

Here is our battle field

Page 51: Alfresco in few points - Search Tutorial

Practice

Page 52: Alfresco in few points - Search Tutorial

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!

Page 53: Alfresco in few points - Search Tutorial

How to make a simple query with Lucene

Connect as « admin » to Alfresco

Click on

Choose the node browser

Page 54: Alfresco in few points - Search Tutorial

How to make a simple query with Lucene

Choose the store : workspace://SpacesStore

In the drop down list, choose Lucene

Page 55: Alfresco in few points - Search Tutorial

Ready ?

Page 56: Alfresco in few points - Search Tutorial

I want the« Folder Test »

Page 57: Alfresco in few points - Search Tutorial
Page 58: Alfresco in few points - Search Tutorial

I want the « Folder Test »!!!!!

@cm\:name:’’Folder Test’’@cm\:name:’’Folder Test’’

Page 59: Alfresco in few points - Search Tutorial

Result

Page 60: Alfresco in few points - Search Tutorial

Reminder !

Page 61: Alfresco in few points - Search Tutorial

To identify and make a node unique in a store, we use…

AUUID

Page 62: Alfresco in few points - Search Tutorial

The concatenation of the protocole, the name of the store

and the UUID of a node is

ANodeRef

Page 63: Alfresco in few points - Search Tutorial

In our case

UUIDNodeRef

Page 64: Alfresco in few points - Search Tutorial

I want the « Foder Test » with

the UUID ID:"workspace://SpacesStore/ID:"workspace://SpacesStore/

b7ecc8b1-5edb-11dd-b7ecc8b1-5edb-11dd-afdd-79a008cbb404"afdd-79a008cbb404"

Page 65: Alfresco in few points - Search Tutorial
Page 66: Alfresco in few points - Search Tutorial

What about a search with several criterias ?

Page 67: Alfresco in few points - Search Tutorial

You can add Operators !

Page 68: Alfresco in few points - Search Tutorial

+ 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

Operators

Page 69: Alfresco in few points - Search Tutorial

I want all the spaces with the name « space »

TYPE:"cm:folder" AND @cm\:name:"Space"

TYPE:"cm:folder" +@cm\:name:"Space"

+TYPE:"cm:folder" AND @cm\:name:"Space"

Page 70: Alfresco in few points - Search Tutorial

Result

Page 71: Alfresco in few points - Search Tutorial

Let’s add a categoryto a space

Context

Page 72: Alfresco in few points - Search Tutorial

I want all folders with the name « space » which has a category

TYPE:"cm:folder" AND @cm\:name:"Space"

AND ASPECT:"cm:generalclassifiable"

Page 73: Alfresco in few points - Search Tutorial

I want all spaces with the name « space » which

DOES NOT have a categoryTYPE:"cm:folder"

AND @cm\:name:"Space" AND NOT ASPECT:"cm:generalclassifiable"

TYPE:"cm:folder" +@cm\:name:"Space" -ASPECT:"cm:generalclassifiable"

Page 74: Alfresco in few points - Search Tutorial

Result

Page 75: Alfresco in few points - Search Tutorial

Let’s have a look into the property types

Page 76: Alfresco in few points - Search Tutorial

Note

Work Zone!

This section is experimental and results

vary a lot according to the tests!

Page 77: Alfresco in few points - Search Tutorial

To search for text properties, you can use specific operators

Page 78: Alfresco in few points - Search Tutorial

? Can replace one character

* Can replace one or many

characters

Special Operators

Page 79: Alfresco in few points - Search Tutorial

I want all spaces with the name starting with « spa »

TYPE:"cm:folder" AND @cm\:name:"Spa*"

TYPE:"cm:folder" +@cm\:name:"Spa*"

Page 80: Alfresco in few points - Search Tutorial

I want all spaces with the name ending with « spa »

TYPE:"cm:folder" AND @cm\:name:"*ace"

TYPE:"cm:folder" +@cm\:name:"*ace"

Page 81: Alfresco in few points - Search Tutorial

Note

End of work zone!

This section was experimental!

Page 82: Alfresco in few points - Search Tutorial

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

Page 83: Alfresco in few points - Search Tutorial

Now XPath!

Page 84: Alfresco in few points - Search Tutorial

XPath ?• XPath is a language for

addressing parts of an XML document, designed to be used by both XSLT and XPointer.

• Source w3c.org

Page 85: Alfresco in few points - Search Tutorial

But we are dealing with nodes… Not with xml…

Page 86: Alfresco in few points - Search Tutorial

Yes indeed but…

Page 87: Alfresco in few points - Search Tutorial

A Principle…A Node can be identified

as an xmlMirror

XML

What a face I have now…

Page 88: Alfresco in few points - Search Tutorial

The proof in Alfresco…

Page 89: Alfresco in few points - Search Tutorial

WebApp

ACP

Page 90: Alfresco in few points - Search Tutorial

Explorer

ACP

Page 91: Alfresco in few points - Search Tutorial

So XPath enables us to browse the nodes…

Page 92: Alfresco in few points - Search Tutorial

Indeed !Demo...

Page 93: Alfresco in few points - Search Tutorial

A bit of theory

Page 94: Alfresco in few points - Search Tutorial

XPath in Alfresco enables to query on…

Why me…

• The TypeThe Type

• The PropertiesThe Properties

• The AspectsThe Aspects

• The AssociationsThe Associations

Of a Node!Of a Node!

Page 95: Alfresco in few points - Search Tutorial

Axis

Page 96: Alfresco in few points - Search Tutorial

In the Node family, I want to find myself !

selfself

Page 97: Alfresco in few points - Search Tutorial

Then my Father!

parentparent

Page 98: Alfresco in few points - Search Tutorial

Then my children!

ChildChild

Page 99: Alfresco in few points - Search Tutorial

Then my older brothers

preceding-siblingpreceding-sibling

Page 100: Alfresco in few points - Search Tutorial

Then my younger sisters

following-siblingfollowing-sibling

Page 101: Alfresco in few points - Search Tutorial

Now let’s explore my family further

Page 102: Alfresco in few points - Search Tutorial

I want to know my entire lineage!

descendantdescendant

Page 103: Alfresco in few points - Search Tutorial

I want to know my ancestors

ancestorancestor

Page 104: Alfresco in few points - Search Tutorial

I want to know all the oldest nodes in my family

precedingpreceding

Page 105: Alfresco in few points - Search Tutorial

I want all the youngest nodes

followingfollowing

Page 106: Alfresco in few points - Search Tutorial

Isn’t my family beautiful?

Page 107: Alfresco in few points - Search Tutorial

Unfortunately, all my family are not visible in

Alfresco…

precedingpreceding

followingfollowing

preceding-siblingpreceding-sibling

following-siblingfollowing-sibling

Page 108: Alfresco in few points - Search Tutorial

The queries

Page 109: Alfresco in few points - Search Tutorial

To query on an axis

I want to know all the nodes on this axis!

Axe::*Axe::*

Page 110: Alfresco in few points - Search Tutorial

To query on a property

It remind me of Lucene…

Axe::*[@<QName>:’<Value>’Axe::*[@<QName>:’<Value>’]

Page 111: Alfresco in few points - Search Tutorial

To query on an aspect

The aspect doesn’t make the node!

Axe::*[hasAspect(’<QNameAspect>’)Axe::*[hasAspect(’<QNameAspect>’)]

Page 112: Alfresco in few points - Search Tutorial

To query on a type

Beware! This means the current and child types!!!

Axe::*[subtypeOf(’<QNameType>’)Axe::*[subtypeOf(’<QNameType>’)]

Page 113: Alfresco in few points - Search Tutorial

To query on the entire set of properties and content…

Axe::*[contains(’<Value>’)Axe::*[contains(’<Value>’)]

Beware! This means the current and child types!!!

Page 114: Alfresco in few points - Search Tutorial

Context

Page 115: Alfresco in few points - Search Tutorial

Here is our battle field

Page 116: Alfresco in few points - Search Tutorial

Practice

Page 117: Alfresco in few points - Search Tutorial

How to make a simple query with Lucene

Connect as « admin » to Alfresco

Click on

Choose the node browser

Page 118: Alfresco in few points - Search Tutorial

How to make a simple query with Lucene

Choose the store : workspace://SpacesStore

In the drop down list, choose Lucene

Page 119: Alfresco in few points - Search Tutorial

Why don’t we use XPath ??

Page 120: Alfresco in few points - Search Tutorial

It’s exactly the same!Except that…

Page 121: Alfresco in few points - Search Tutorial

SelectNodes : Related to the current node

XPath : From the root of

the store

Page 122: Alfresco in few points - Search Tutorial

We want to start from a specific folder!

Page 123: Alfresco in few points - Search Tutorial

Ready ?

Page 124: Alfresco in few points - Search Tutorial

I want the current node

self::*

Page 125: Alfresco in few points - Search Tutorial

Result

Page 126: Alfresco in few points - Search Tutorial

I want the children of the current node

descendant::*

Page 127: Alfresco in few points - Search Tutorial

I want the parent of the current node

parent::*

Page 128: Alfresco in few points - Search Tutorial

I want the child which has a description « Space 1.1 Description »

descendant::*[@cm:description='Space 1.1 Description']

Page 129: Alfresco in few points - Search Tutorial

Also note that operators are also available in XPath…

Page 130: Alfresco in few points - Search Tutorial

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')]

Page 131: Alfresco in few points - Search Tutorial

I want the child which has its aspect related to categories and is of type folder

descendant::*[hasAspect('cm:generalclassifiable') and

subtypeOf('cm:folder')]

Page 133: Alfresco in few points - Search Tutorial

I now have many nodes! But where is Wally/Waldo…? Well actually…

where is the good node?

Page 134: Alfresco in few points - Search Tutorial

If you are looking for a node, use the services…

Page 135: Alfresco in few points - Search Tutorial

First, Think about Alfreso Service Registry !

Page 136: Alfresco in few points - Search Tutorial

And then call …ActionService

AttributeServiceAuditService

AuthenticationServiceAuthorityService

AVMService

CategoryService

CheckOutCheckInService

ContentService

CopyService

DictionnaryService

FileFolderService

EditionService

ExporterServiceImporterService

MimeTypeService

MultilangualContentService

NodeService

LockService

RuleService

ScriptService

SearchService

TemplateService

TransactionServiceVersionService

WorkflowService

Page 137: Alfresco in few points - Search Tutorial

And then call …ActionService

AttributeServiceAuditService

AuthenticationServiceAuthorityService

AVMService

CategoryService

CheckOutCheckInService

ContentService

CopyService

DictionnaryService

FileFolderService

EditionService

ExporterServiceImporterService

MimeTypeService

MultilangualContentService

NodeService

LockService

RuleService

ScriptService

SearchService

TemplateService

TransactionServiceVersionService

WorkflowService

Page 138: Alfresco in few points - Search Tutorial

Or…ActionService

AttributeServiceAuditService

AuthenticationServiceAuthorityService

AVMService

CategoryService

CheckOutCheckInService

ContentService

CopyService

DictionnaryService

FileFolderService

EditionService

ExporterServiceImporterService

MimeTypeService

MultilangualContentService

NodeService

LockService

RuleService

ScriptService

SearchService

TemplateService

TransactionServiceVersionService

WorkflowService

Page 139: Alfresco in few points - Search Tutorial
Page 140: Alfresco in few points - Search Tutorial

Voilà! Enough for today!

Page 141: Alfresco in few points - Search Tutorial

Now your turn!

Page 142: Alfresco in few points - Search Tutorial

Questions ???

Page 143: Alfresco in few points - Search Tutorial

Another time…

Page 144: Alfresco in few points - Search Tutorial

Next…

Page 145: Alfresco in few points - Search Tutorial

What if I want to share my nodes ?

Page 146: Alfresco in few points - Search Tutorial

You would have to use the protocoles…

Page 147: Alfresco in few points - Search Tutorial

To discover…

Page 148: Alfresco in few points - Search Tutorial

To go further on…

Page 149: Alfresco in few points - Search Tutorial

And to reach our goals…

Page 150: Alfresco in few points - Search Tutorial

Choose ECM Open Source

Page 151: Alfresco in few points - Search Tutorial

Alfresco in few points…

By JM.PASCAL

www.opensourceecm.fr&

www.open-source-ecm.com