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

Get Connected