alfresco in few points - search tutorial

Post on 17-May-2015

27.241 Views

Category:

Technology

1 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Search Tutorial

What is this flower ?

This represents Alfresco !

An ECM Open Source Solution

Where is the Problem ?

Curious people who want to understand Alfresco…

With lots of questions…(To express…)

A possible solution…

Simply a presenter with presentations about Alfresco

with a few answers… (To verify)

Let’s do it !

But before starting, here is a reminder !

The principle is…Everything is a NODE!

I am a beautiful node!

The rule is…Alfresco provides

services to manage Nodes

Even I have a manager…

Now let’s go!

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

to do searches…

Indeed!Let’s have a look…

XPath

Lucene

Lucene first!

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

And with Alfresco… How does it work?

Put in a nutshell…

1. Collect

PropertiesAspect

Key words

ID

Type

2. Preserve

Properties

Aspect

Key words

IDType

3. Use

Properties

Key wordsAspect

To push further…

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

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

To check it…

Have a look into the data model!

File : contentModel.xml

File : contentModel.xml

What does the « tokenize »

principle mean?

Tokenising is to split (or not) a word into

one or many key words.

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

Example

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

Without « Tokenisation »…

Content

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

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

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

However if the sentence is split into

key words…

Contenu

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

So don’t forget to check your data

model !

OK… Demo time!

A bit of theory

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!

TheQueries

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> "

To query on the Type

Hopefully you remember what’s the QName…

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

Otherwise click here

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 ?

To query on an Aspect

AAhh! That’s better!

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

To query on a key word included in the content of

the node

Okey… Understood!

TEXT:<value>TEXT:<value>

I am getting bored…

Context

Here is our battle field

Practice

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!

How to make a simple query with Lucene

Connect as « admin » to Alfresco

Click on

Choose the node browser

How to make a simple query with Lucene

Choose the store : workspace://SpacesStore

In the drop down list, choose Lucene

Ready ?

I want the« Folder Test »

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

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

Result

Reminder !

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

AUUID

The concatenation of the protocole, the name of the store

and the UUID of a node is

ANodeRef

In our case

UUIDNodeRef

I want the « Foder Test » with

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

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

What about a search with several criterias ?

You can add 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

Operators

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"

Result

Let’s add a categoryto a space

Context

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

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

AND ASPECT:"cm:generalclassifiable"

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"

Result

Let’s have a look into the property types

Note

Work Zone!

This section is experimental and results

vary a lot according to the tests!

To search for text properties, you can use specific operators

? Can replace one character

* Can replace one or many

characters

Special Operators

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

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

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

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

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

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

Note

End of work zone!

This section was experimental!

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

Now XPath!

XPath ?• XPath is a language for

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

• Source w3c.org

But we are dealing with nodes… Not with xml…

Yes indeed but…

A Principle…A Node can be identified

as an xmlMirror

XML

What a face I have now…

The proof in Alfresco…

WebApp

ACP

Explorer

ACP

So XPath enables us to browse the nodes…

Indeed !Demo...

A bit of theory

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!

Axis

In the Node family, I want to find myself !

selfself

Then my Father!

parentparent

Then my children!

ChildChild

Then my older brothers

preceding-siblingpreceding-sibling

Then my younger sisters

following-siblingfollowing-sibling

Now let’s explore my family further

I want to know my entire lineage!

descendantdescendant

I want to know my ancestors

ancestorancestor

I want to know all the oldest nodes in my family

precedingpreceding

I want all the youngest nodes

followingfollowing

Isn’t my family beautiful?

Unfortunately, all my family are not visible in

Alfresco…

precedingpreceding

followingfollowing

preceding-siblingpreceding-sibling

following-siblingfollowing-sibling

The queries

To query on an axis

I want to know all the nodes on this axis!

Axe::*Axe::*

To query on a property

It remind me of Lucene…

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

To query on an aspect

The aspect doesn’t make the node!

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

To query on a type

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

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

To query on the entire set of properties and content…

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

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

Context

Here is our battle field

Practice

How to make a simple query with Lucene

Connect as « admin » to Alfresco

Click on

Choose the node browser

How to make a simple query with Lucene

Choose the store : workspace://SpacesStore

In the drop down list, choose Lucene

Why don’t we use XPath ??

It’s exactly the same!Except that…

SelectNodes : Related to the current node

XPath : From the root of

the store

We want to start from a specific folder!

Ready ?

I want the current node

self::*

Result

I want the children of the current node

descendant::*

I want the parent of the current node

parent::*

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

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

Also note that operators are also available in XPath…

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

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

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

subtypeOf('cm:folder')]

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

where is the good node?

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

First, Think about Alfreso Service Registry !

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

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

Or…ActionService

AttributeServiceAuditService

AuthenticationServiceAuthorityService

AVMService

CategoryService

CheckOutCheckInService

ContentService

CopyService

DictionnaryService

FileFolderService

EditionService

ExporterServiceImporterService

MimeTypeService

MultilangualContentService

NodeService

LockService

RuleService

ScriptService

SearchService

TemplateService

TransactionServiceVersionService

WorkflowService

Voilà! Enough for today!

Now your turn!

Questions ???

Another time…

Next…

What if I want to share my nodes ?

You would have to use the protocoles…

To discover…

To go further on…

And to reach our goals…

Choose ECM Open Source

Alfresco in few points…

By JM.PASCAL

www.opensourceecm.fr&

www.open-source-ecm.com

top related