summaryrefslogtreecommitdiff
path: root/docs/search_engines.rst
blob: b960ddbb4cd26cf34eac6309ab045cc5ec6a8b44 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
==============
Search Engines
==============

.. module:: gstudio.views.search

Gstudio like almost all blogging systems contains a
:func:`search engine<entry_search>` feature.

But in fact there are 2 search engines, a basic and an advanced, the
advanced search engine is enabled by default, but if he fails the
basic search engine will resume the job.

.. _basic-search-engine:

Basic Search Engine
===================

The basic search engine is the original engine of Gstudio, and will be used
if the advanced engine cannot be used.

It will always returns more results than the advanced engine, because each
terms of the query will be searched in the entries and the results are
added to a main result list. We can say that the results are inclusives.

Example of a query :
  ``love paris``

  This will returns all the entries containing the terms ``love`` or
  ``paris``.

.. _advanced-search-engine:

Advanced Search Engine
======================

.. module:: gstudio.search

The advanced search engine has several possibilities for making more
elaborated queries, with it's own grammar system.

The grammar of the search is close to the main search engines like Google
or Yahoo.

The main difference with the basic engine is that the results are
exclusives.

For enabling the advanced search engine, you simply need to install the
:mod:`pyparsing` package. Otherelse the basic engine will be used.

.. _advanced-search-examples:

Query examples
--------------

Here a list of examples and possibilities:

Example of a query with terms:
   ``love paris``

   This will returns all the entries containing the terms ``love`` and
   ``paris``.

Example of a query with excluded terms:
   ``paris -hate``

   This will returns all the entries containing the term ``paris`` without
   the term ``hate``.

Example of a query with expressions:
   ``"Paris, I love you"``

   This will returns all the entries containing the expression
   ``Paris, I love you``.

Example of a query with **category operator**:
   ``love category:paris``

   This will returns all the entries containing the term ``love`` filled in
   the category named ``paris``.

Example of a query with **tag operator**:
   ``paris tag:love``

   This will returns all the entries containing the term ``paris`` with the
   tag ``love``.

Example of a query with **author operator**:
   ``paris author:john``

   This will returns all the entries containing the term ``paris`` writed by
   ``john``.

Example of a query with boolean operator:
   ``paris or berlin``

   This will returns all the entries containing the term ``paris`` or
   ``berlin``.

Example of e query with parenthesis:
   ``(paris or berlin) love``

   This will returns all the entries containing the terms ``paris`` or
   ``berlin`` with the term ``love``.

Complex example:
   ``((paris or berlin) and (tag:love or category:meet*) girl -money``

   This will returns all the entries containing the terms ``paris`` or
   ``berlin`` with the tag ``love`` or filled under the categories starting
   by ``meet`` also containing the term ``girl`` excluding entries with the
   term ``money``.


Note that the query is stripped of common words known as stop words.
These are words such as **on**, **the** or **which** that are generally
not meaningful and cause irrelevant results.

The list of stop words is stored in the :setting:`GSTUDIO_STOP_WORDS` setting.