Maarch Framework 3/Developer handbook/Indexing Searching

De Maarch Wiki.

< Maarch Framework 3 | Developer handbook
Version du 5 mars 2009 à 15:22 par Bca (discuter | contributions)
(diff) ← Version précédente | Voir la version courante (diff) | Version suivante → (diff)
Warning.gif Cette section du wiki est en cours de restructuration et de rédaction. Nous nous excusons pour la gêne occasionnée.
This section of the wiki is under heavy restructuring and writing. We're sorry for the inconvenience.

Sommaire

Summary

Installation

Quick Install

The tables for this module are defined in the file indexing_searching/sql/structure/ directory depending on your databasetype, and the mimimal data in the indexing_searching/sql/data/ directory. For the moment, we provide only mysql and postgresql scripts, but it is not difficult to build script for other database with existing scripts.

To load the module just add these lines in the apps config.xml file in the <MODULES> section :

<MODULES>
  <moduleid>indexing_searching</moduleid>
  <comment>_INDEXING_SEARCHING</comment>
</MODULES>

Make sure the service is active (the <loaded> tag is set to true in indexing_searching/xml/config.xml).

Setting

config.xml file

<?xml version="1.0" encoding="utf-8"?>
<root>
	<CONFIG>
		<name>indexing_searching</name> <!-- module name : MUST BE THE DIRECTORY NAME OF THE 
                                                     MODULE -->
		<comment>_INDEXING_SEARCHING</comment> <!-- Label of the module, defined in the basket
                                                            language file -->
		<file_prefix>is</file_prefix>
		<loaded>true</loaded> <!-- must be true otherwise the services will not work -->
	</CONFIG>
	<TABLENAME> <!-- Module specific tables : this module has no specific tables -->
	</TABLENAME>
	<HISTORY> <!-- What will be traced in the module -->
		<resadd>true</resadd>	<!-- New resource added -->				
		<resup>true</resup>	<!-- Resource informations modified -->					
		<resdel>true</resdel> <!-- Resource deleted -->
		<resview>true</resview> <!-- Resource informations or document viewed -->
	</HISTORY>
	<KEYWORDS> <!-- list of this module keywords for the history events : each label var is 
                        defined in this module language file -->
		<id>VIEW</id>
		<label>_VIEW</label>
	</KEYWORDS>
</root>

The <HISTORY> tag contains the list of events that can be logged. To disabled one, just set its tag to false.

extensions.xml file

Any type of file can be indexed in Maarch Framework. However, you can define in this file what specific type users can index.

Every allowed type must be defined in a <FORMAT> bloc.

As a web browser cannot display every file, you can set which one can be displayed in your environment by setting the <index_frame_show> tag to true.

Here are some examples:

<?xml version="1.0" encoding="utf-8"?>
<ROOT>
	<FORMAT>
		<name>PDF</name> <!-- File format extension name : IN UPPER CASE -->
		<mime>application/pdf</mime> <!-- Mime type : will be used by the browser to read the 
                                                  file-->
		<index_frame_show>true</index_frame_show> <!-- If true, the browser will read the 
                       file, otherwise the file will not be displayed : used if some browser do not have the good reading
                       plugin -->
	</FORMAT>
	<FORMAT>
		<name>TXT</name>
		<mime>text/plain</mime>
		<index_frame_show>true</index_frame_show>
	</FORMAT>
	<FORMAT>
		<name>DOC</name>
		<mime>application/msword</mime>
		<index_frame_show>false</index_frame_show>
	</FORMAT>
</ROOT>

index.xml file

Each document collection must be asocciated with an index.xml file. The mapping is done in the apps configuration (in the <COLLECTION> bloc).

Several collection can be associated with the same index.xml file (see apps config.xml file).

<?xml version="1.0" encoding="utf-8"?>
<ROOT>
	<INDEX>
		<COLUMN>custom_t1</COLUMN> <!-- Maarch Res_X Table column -->
		<LABEL>_PO_NUMBER</LABEL> <!-- Index label -->
		<ITERATIVE>no</ITERATIVE> <!-- NOT YET IMPLEMENTED : SET AT no -->
	</INDEX>
	<INDEX>
		<COLUMN>custom_t2</COLUMN>
		<LABEL>_CONTACT_NAME</LABEL>
		<ITERATIVE>no</ITERATIVE>
	</INDEX>
	<INDEX>
		<COLUMN>custom_t3</COLUMN>
		<LABEL>_COUNTRY</LABEL>
		<ITERATIVE>no</ITERATIVE>
	</INDEX>
	<INDEX>
		<COLUMN>custom_n1</COLUMN>
		<LABEL>_AMOUNT</LABEL>
		<ITERATIVE>no</ITERATIVE>
	</INDEX>
	<INDEX>
		<COLUMN>custom_t4</COLUMN>
		<LABEL>_CUSTOMER</LABEL>
		<ITERATIVE>no</ITERATIVE>
	</INDEX>
</ROOT>

The labels are defined in the module language files.

The <COLUMN> tag MUST BE one of the custom fields of the resource table of the collection.

Provided Services

All the localization constants used in service.xml are defined in the indexing_searching languages files.

All the css styles defined in the <style> tag are defined in css files of the indexing_searching/css directory.

By default, some service are defined as system services, it means that these services will be activated for all users. You can easily modify it by setting the <system_service> tag to false.

To deactivate a service, simply set the <enabled> tag to false.

Service Type System Service Description
#modify_res use no Modify the resource information
#indexing menu no Menu Item, indexing a new document
#adv_search menu no Menu item, Advanced search
#delete_res use no Delete a document
#index_file use yes Indexing a new document in a collection
#index_file2 use yes Indexing a new document in a collection

modify_res

This service allows to modify the resource information.

<SERVICE>
   <id>modify_res</id>  <!-- service identifier -->
   <name>_MODIFY_RESOURCE</name>  <!-- service label -->
   <comment>_MODIFY_RESOURCE</comment>  <!-- service description -->
   <servicepage>none</servicepage> <!-- service page -->
   <servicetype>use</servicetype> <!-- service type -->
    <system_service>false</system_service>
   <enabled>true</enabled>
  </SERVICE>

This service is a use service. This is not a system service by default.

indexing

This service gives access to the menu item Indexing.

 <SERVICE>
   <id>indexing</id> <!-- if servicetype = menu, this id must be equal to the id of the menu item -->
   <name>_INDEXING</name>
   <servicetype>menu</servicetype>
    <system_service>false</system_service>
   <enabled>true</enabled>
  </SERVICE>

This service is a menu service. This is not a system service by default.

adv_search

This service gives access to the menu item Advanced Search.

 <SERVICE>
   <id>adv_search</id>
   <name>_ADV_SEARCH</name>
   <servicetype>menu</servicetype>
    <system_service>false</system_service>
   <enabled>true</enabled>
  </SERVICE>

This service is a menu service. This is not a system service by default.

delete_res

This service gives the right to delete a document.

<SERVICE>
   <id>delete_res</id>
   <name>_DELETE_RESOURCE</name>
   <comment>_DELETE_RESOURCE</comment>
   <servicepage>delete_file_popup.php</servicepage>
   <servicetype>use</servicetype>
    <system_service>false</system_service>
   <enabled>true</enabled>
   <WHEREAMIUSED>
     <page>index.php?page=details</page>
     <nature>button</nature>
	 <button_label>_DELETE_RES</button_label>
     <width>550</width>
     <height>200</height>
   </WHEREAMIUSED>

This service is a use service. This is not a system service by default.

index_file

This service allows to add a new document in a collection.

<SERVICE>
   <id>index_file</id>
   <name>_INDEX_FILE_DOC</name>
   <comment>_INDEX_FILE</comment>
   <servicepage>res_type.php</servicepage>
   <servicetype>use</servicetype>
    <system_service>true</system_service>
   <enabled>true</enabled>
   <WHEREAMIUSED>
     <page>index_documents.php</page>
     <nature>tab</nature>
	 <tab_label>_INDEX</tab_label>
	 <tab_order>3</tab_order>
   </WHEREAMIUSED>
   <PROCESSINBACKGROUND>
     <page>file_index.php</page>
	 <preprocess>res_type_result_preprocess.php</preprocess>
	 <processorder>2</processorder>
   </PROCESSINBACKGROUND>
  </SERVICE>

This service is a use service. This is a system service by default.

index_file2

This service allows to add a new document in a collection.

<SERVICE>
   <id>index_file2</id>
   <name>_INDEX_FILE_INV</name>
   <comment>_INDEX_FILE</comment>
   <servicepage>res_type2.php</servicepage>
   <servicetype>use</servicetype>
    <system_service>true</system_service>
   <enabled>true</enabled>
    <WHEREAMIUSED>
     <page>index_invoices.php</page>
     <nature>frame</nature>
	 <width>515</width>
     <height>430</height>
	 <scrolling>auto</scrolling>
	 <border>0</border>
   </WHEREAMIUSED>
   <PROCESSINBACKGROUND>
     <page>file_index2.php</page>
	 <preprocess>res_type2_result_preprocess.php</preprocess>
	 <processorder>1</processorder>
   </PROCESSINBACKGROUND>
  </SERVICE>

This service is a use service. This is a system service by default.

Customisation

The Maarch Framework v3 sample application has been written to illustrate the Maarch Framework potential. From the sample application, you can make your own document management application, provided that you create your own application directory and scripts, and that updates Indexing & Searching module.

This diagram illustrates what's happening when indexing a new resource inside the sample : Index file syn.png

This diagram illustrates what's happening during a search inside the sample : Search adv syn.png

Language