-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
David Durieux
committed
Oct 1, 2016
1 parent
cf4f585
commit 2f291e8
Showing
2 changed files
with
85 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,3 +7,4 @@ Here are the specifications used before code a part, so it will be use by develo | |
:maxdepth: 2 | ||
|
||
pdo | ||
searchengine |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
Search engine | ||
============= | ||
|
||
|
||
Introduction | ||
------------ | ||
|
||
The search engine need to be updated, there are the points need to be updated: | ||
|
||
* delete META because it's too complex to maintain | ||
* need to be able group queries | ||
* queries too complex (too many joins) and result query too long or block database for a time. | ||
|
||
|
||
Display choice | ||
-------------- | ||
|
||
Use _jquerybuiler | ||
|
||
We remove META. For example in computer, we have criteria of computer and linked (networkport, infocom...) + software criteria and linked | ||
+ monitor criteria and linked... All in same dropdown, but with grouped differently (optgroup). | ||
|
||
|
||
Internal | ||
-------- | ||
|
||
All queries use simple queries to be fast. | ||
|
||
Search class | ||
~~~~~~~~~~~~ | ||
|
||
function show | ||
_____________ | ||
|
||
This function is used to display query builder form | ||
|
||
|
||
function showList | ||
_________________ | ||
|
||
This function manage searh result. | ||
|
||
We call in this function the functions: | ||
|
||
* ``prepareDatasForSearch``: traduct query-builder params | ||
* ``search_get_all_ids``: get all ids of the item (like in computer search, all id) of each jquery-builder groups | ||
* ``search_ids_operations``: do operations (AND, OR) of groups of id | ||
* ``prepareDisplayIdName``: with the array IDs found, get the id + name (+ comment) of each column | ||
* ``prepareColumns``: convert each column to the field / html code | ||
* ``displayDatas``: display the data | ||
|
||
|
||
getSearchOptions function | ||
~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
With the end of META, each property will receive a unique number for all GLPI (now we can have same number in computer and in software). | ||
|
||
|
||
We remove key ``joinparams`` and replace by ``path``. This key will specify the table + foreignkey to use to go to the value we want. | ||
Example in computer search to have software name: | ||
|
||
.. code:: php | ||
$tab[801]['path'] = [ | ||
array( | ||
'table' => Computer_SoftwareVersion::getTable(), | ||
'field' => 'computer_id' | ||
), | ||
array( | ||
'table' => SoftwareVersion::getTable(), | ||
'field' => 'softwareversion_id' | ||
), | ||
array( | ||
'table' => Software::getTable(), | ||
'field' => 'software_id' | ||
), | ||
); | ||
This that, the code in search engine will be easier to create queries to get information. | ||
|
||
|
||
|
||
.. _jquerybuilder: http://querybuilder.js.org/ |