<
From version < 2.1 >
edited by Vincent Massol
on 2010/12/08 19:42
To version < 1.2 >
edited by Vincent Massol
on 2010/12/08 19:40
>
Change comment: There is no comment for this version

Summary

Details

Page properties
Syntax
... ... @@ -1,1 +1,1 @@
1 -XWiki 2.1
1 +XWiki 1.0
Content
... ... @@ -1,20 +3,13 @@
1 -{{velocity filter="none"}}
2 -{{html clean="false" wiki="true"}}
3 3  #startfloatingbox()
4 -**Contents**
5 -
6 -{{toc start="2" depth="3" numbered=""/}}
2 +*Contents*
3 +#toc ("2" "3" "")
7 7  #endfloatingbox()
8 -{{/html}}
9 -{{/velocity}}
10 10  
11 -= Lucene Search Query Help =
6 +1 Lucene Search Query Help
12 12  
13 -{{info}}
14 -Need more informations ? see the [[lucene website>>http://lucene.apache.org/java/docs/queryparsersyntax.html]]
15 -{{/info}}
8 +#info("Need more informations ? see the [lucene website>http://lucene.apache.org/java/docs/queryparsersyntax.html]")
16 16  
17 -== Terms ==
10 +1.1 Terms
18 18  
19 19  A query is broken up into terms and operators. There are two types of terms: Single Terms and Phrases.
20 20  
... ... @@ -21,237 +21,224 @@
21 21  * A Single Term is a single word such as "test" or "hello".
22 22  * A Phrase is a group of words surrounded by double quotes such as "hello dolly".
23 23  
24 -{{info}}
25 -Multiple terms can be combined together with Boolean operators to form a more complex query (see below).
26 -{{/info}}
17 +#info("Multiple terms can be combined together with Boolean operators to form a more complex query (see below).")
27 27  
28 -== Wildcard Searches ==
19 +1.1 Wildcard Searches
29 29  
30 30  Lucene supports single and multiple character wildcard searches within single terms (not within phrase queries).
31 31  
32 32  * To perform a single character wildcard search use the "?" symbol.
33 -* To perform a multiple character wildcard search use the "*" symbol.
24 +* To perform a multiple character wildcard search use the "&#42;" symbol.
34 34  
35 35  The single character wildcard search looks for terms that match that with the single character replaced. For example, to search for "text" or "test" you can use the search:
36 36  
37 -{{code}}
28 +{code}
38 38  te?t
39 -{{/code}}
30 +{code}
40 40  
41 41  Multiple character wildcard searches looks for 0 or more characters. For example, to search for test, tests or tester, you can use the search:
42 42  
43 -{{code}}
34 +{code}
44 44  test*
45 -{{/code}}
36 +{code}
46 46  
47 47  You can also use the wildcard searches in the middle of a term.
48 48  
49 -{{code}}
40 +{code}
50 50  te*t
51 -{{/code}}
42 +{code}
52 52  
53 -{{warning}}
54 -Note: You cannot use a * or ? symbol as the first character of a search.
55 -{{/warning}}
44 +#warning("Note: You cannot use a &#42; or ? symbol as the first character of a search.")
56 56  
57 -== Boolean Operators ==
46 +1.1 Boolean Operators
58 58  
59 -Boolean operators allow terms to be combined through logic operators. Lucene supports AND, "+", OR, NOT and "-" as Boolean operators(Note: Boolean operators must be ALL CAPS).
48 +Boolean operators allow terms to be combined through logic operators. Lucene supports AND, "+", OR, NOT and "&#45;" as Boolean operators(Note: Boolean operators must be ALL CAPS).
60 60  
61 61  The OR operator is the default conjunction operator. This means that if there is no Boolean operator between two terms, the OR operator is used. The OR operator links two terms and finds a matching document if either of the terms exist in a document. This is equivalent to a union using sets. The symbol || can be used in place of the word OR.
62 62  
63 63  To search for documents that contain either "jakarta apache" or just "jakarta" use the query:
64 64  
65 -{{code}}
54 +{code}
66 66  "jakarta apache" jakarta
67 -{{/code}}
56 +{code}
68 68  
69 69  or
70 70  
71 -{{code}}
60 +{code}
72 72  "jakarta apache" OR jakarta
73 -{{/code}}
62 +{code}
74 74  
75 -=== AND ===
64 +1.1.1 AND
76 76  
77 77  The AND operator matches documents where both terms exist anywhere in the text of a single document. This is equivalent to an intersection using sets. The symbol && can be used in place of the word AND.
78 78  
79 79  To search for documents that contain "jakarta apache" and "Apache Lucene" use the query:
80 80  
81 -{{code}}
70 +{code}
82 82  "jakarta apache" AND "Apache Lucene"
83 -{{/code}}
72 +{code}
84 84  
85 -=== + ===
74 +1.1.1 +
86 86  
87 87  The "+" or required operator requires that the term after the "+" symbol exist somewhere in a the field of a single document.
88 88  
89 89  To search for documents that must contain "jakarta" and may contain "lucene" use the query:
90 90  
91 -{{code}}
80 +{code}
92 92  +jakarta lucene
93 -{{/code}}
82 +{code}
94 94  
95 -=== NOT ===
84 +1.1.1 NOT
96 96  
97 97  The NOT operator excludes documents that contain the term after NOT. This is equivalent to a difference using sets. The symbol ! can be used in place of the word NOT.
98 98  
99 99  To search for documents that contain "jakarta apache" but not "Apache Lucene" use the query:
100 100  
101 -{{code}}
90 +{code}
102 102  "jakarta apache" NOT "Apache Lucene"
103 -{{/code}}
92 +{code}
104 104  
105 105  Note: The NOT operator cannot be used with just one term. For example, the following search will return no results:
106 106  
107 -{{code}}
96 +{code}
108 108  NOT "jakarta apache"
109 -{{/code}}
98 +{code}
110 110  
111 -=== - ===
100 +1.1.1 &#45;
112 112  
113 -The "-" or prohibit operator excludes documents that contain the term after the "-" symbol.
102 +The "&#45;" or prohibit operator excludes documents that contain the term after the "&#45;" symbol.
114 114  
115 115  To search for documents that contain "jakarta apache" but not "Apache Lucene" use the query:
116 116  
117 -{{code}}
106 +{code}
118 118  "jakarta apache" &#45;"Apache Lucene"
119 -{{/code}}
108 +{code}
120 120  
121 -=== Grouping ===
110 +1.1.1 Grouping
122 122  
123 123  Lucene supports using parentheses to group clauses to form sub queries. This can be very useful if you want to control the boolean logic for a query.
124 124  
125 125  To search for either "jakarta" or "apache" and "website" use the query:
126 126  
127 -{{code}}
116 +{code}
128 128  (jakarta OR apache) AND website
129 -{{/code}}
118 +{code}
130 130  
131 131  This eliminates any confusion and makes sure you that website must exist and either term jakarta or apache may exist.
132 132  
133 -=== Field Grouping ===
122 +1.1.1 Field Grouping
134 134  
135 135  Lucene supports using parentheses to group multiple clauses to a single field.
136 136  
137 137  To search for a title that contains both the word "return" and the phrase "pink panther" use the query:
138 138  
139 -{{code}}
128 +{code}
140 140  title:(+return +"pink panther")
141 -{{/code}}
130 +{code}
142 142  
143 -== Escaping Special Characters ==
132 +1.1 Escaping Special Characters
144 144  
145 145  Lucene supports escaping special characters that are part of the query syntax. The current list special characters are
146 146  
147 -{{code}}
136 +{code}
148 148  + - && || ! ( ) { } [ ] ^ " ~ * ? : \
149 -{{/code}}
138 +{code}
150 150  
151 -To escape these character use the before the character. For example to search for (1+1):2 use the query:
140 +To escape these character use the \ before the character. For example to search for (1+1):2 use the query:
152 152  
153 -{{code}}
142 +{code}
154 154  \(1\+1\)\:2
155 -{{/code}}
144 +{code}
156 156  
157 -== Searchable fields ==
146 +1.1 Searchable fields
158 158  
159 159  XWiki documents contain wiki content and meta-information, lucene indexes such information in fields.
160 160  
161 -=== wiki ===
150 +1.1.1 wiki
162 162  
163 163  In a wiki farm you can specify a wiki to search in with the "wiki:" prefix.
164 164  
165 165  Look for the word "test" in the wiki "mywiki":
155 +{code}
156 +test AND wiki:mywiki
157 +{code}
166 166  
167 -{{code}}
168 -test AND wiki:mywiki
169 -{{/code}}
159 +1.1.1 title
170 170  
171 -=== title ===
172 -
173 173  Look for documents with title "Welcome to your wiki":
174 -
175 -{{code}}
162 +{code}
176 176  title:"Welcome to your wiki"
177 -{{/code}}
164 +{code}
178 178  
179 -=== name ===
166 +1.1.1 name
180 180  
181 181  Look for documents named "WebHome":
182 -
183 -{{code}}
169 +{code}
184 184  name:WebHome
185 -{{/code}}
171 +{code}
186 186  
187 -=== lang ===
173 +1.1.1 lang
188 188  
189 189  Look for "Voila" in french documents :
190 -
191 -{{code}}
176 +{code}
192 192  Voila AND lang:fr
193 -{{/code}}
178 +{code}
194 194  
195 -=== type ===
180 +1.1.1 type
196 196  
197 197  Type of a document: "attachment", "wikipage" or "objects", used to control presentation of searchresults.
198 198  
199 199  Look for "test" in attachments :
200 -
201 -{{code}}
185 +{code}
202 202  test AND type:attachment
203 -{{/code}}
187 +{code}
204 204  
205 -=== filename ===
189 +1.1.1 filename
206 206  
207 207  Look for attachments with a filename starting by "test":
208 -
209 -{{code}}
192 +{code}
210 210  filename:test*
211 -{{/code}}
194 +{code}
212 212  
213 -=== object ===
196 +1.1.1 object
214 214  
215 215  The "object:" prefix allow to search for pages containing objects from a specific class.
216 216  
217 217  Look for comments containing the word "test":
218 -
219 -{{code}}
201 +{code}
220 220  test AND object:XWiki.XWikiComments
221 -{{/code}}
203 +{code}
222 222  
223 -=== author ===
205 +1.1.1 author
224 224  
225 225  Look for documents last modified by XWiki.Admin:
226 -
227 -{{code}}
208 +{code}
228 228  author:XWiki.Admin
229 -{{/code}}
210 +{code}
230 230  
231 -=== date ===
212 +1.1.1 date
232 232  
233 233  Date format: yyyyMMddHHmm
234 234  
235 235  Look for documents last modified on 2009/07/08:
236 -
237 -{{code}}
217 +{code}
238 238  date:20090708*
239 -{{/code}}
219 +{code}
240 240  
241 -=== creator ===
221 +1.1.1 creator
242 242  
243 243  Look for documents created by XWiki.Admin:
244 -
245 -{{code}}
224 +{code}
246 246  creator:XWiki.Admin
247 -{{/code}}
226 +{code}
248 248  
249 -=== creationdate ===
228 +1.1.1 creationdate
250 250  
251 251  Date format: yyyyMMddHHmm
252 252  
253 253  Look for documents created on 2009/07/08:
254 -
255 -{{code}}
233 +{code}
256 256  creationdate:20090708*
257 -{{/code}}
235 +{code}
236 +
237 +

Get Connected