Skip to content

Commit 9c4ded6

Browse files
Lubos KoscoLubos Kosco
authored andcommitted
lucene 4.2.1 , document new query parser, allow path regexp if just one and enclosed in /
1 parent b296203 commit 9c4ded6

File tree

4 files changed

+13
-7
lines changed

4 files changed

+13
-7
lines changed

nbproject/project.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ jnlp.mixed.code=default
4444
jnlp.signing=
4545
jnlp.signing.alias=
4646
jnlp.signing.keystore=
47-
lucene.version=4.2.0
47+
lucene.version=4.2.1
4848
lucene-core.jar=lucene-core-${lucene.version}.jar
4949
lucene-analyzers-common.jar=lucene-analyzers-common-${lucene.version}.jar
5050
lucene-queryparser.jar=lucene-queryparser-${lucene.version}.jar

opengrok-web-nbproject/nbproject/project.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ dist.javadoc.dir=${dist.dir}/javadoc
2525
dist.war=${dist.dir}/${war.name}
2626
endorsed.classpath=
2727
excludes=
28-
lucene.version=4.2.0
28+
lucene.version=4.2.1
2929
lucene-core.jar=lucene-core-${lucene.version}.jar
3030
lucene-analyzers-common.jar=lucene-analyzers-common-${lucene.version}.jar
3131
lucene-queryparser.jar=lucene-queryparser-${lucene.version}.jar

src/org/opensolaris/opengrok/search/QueryBuilder.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,8 @@ private String escapeQueryString(String field, String query) {
270270
return query.replace("::", "\\:\\:");
271271
case PATH:
272272
// workaround for replacing / with escaped / - needed since lucene 4.x
273-
return (query.replace(":", "\\:")).replace("/", "\\/");
273+
if (!(query.startsWith("/") && query.endsWith("/"))) {
274+
return (query.replace(":", "\\:")).replace("/", "\\/"); }
274275
// Other fields shouldn't use qualified terms, so escape colons
275276
// so that we can search for them.
276277
default:

web/help.jsp

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,14 +75,19 @@ A <dfn>Query</dfn> is a series of clauses. A clause may be prefixed by:</p>
7575
<b>OR</b>(<b>||</b>), <b>NOT</b>(<b>!</b>) and "<b>-</b>" (Note: they
7676
must be ALL CAPS).</li>
7777
</ul>
78-
<p>Wildcard, Fuzzy, Proximity &amp; Range Searches:</p>
78+
<p>Regular Expression, Wildcard, Fuzzy, Proximity &amp; Range Searches:</p>
7979
<ul>
80+
<li>to perform a regular expression search use the "<b>/</b>" enclosure,
81+
e.g. /[mb]an/ - will search for man or for ban;
82+
NOTE: path field search escapes "/" by default, so it only supports
83+
regexps when the search string <u>starts and ends</u> with "/"
84+
</li>
8085
<li>to perform a single character wildcard search use the "<b>?</b>" symbol,
8186
e.g. te?t</li>
8287
<li>to perform a multiple character wildcard search use the "<b>*</b>"
8388
symbol, e.g. test* or te*t</li>
84-
<li>you cannot use a * or ? symbol as the first character of a search
85-
(unless enabled using indexer option -a).</li>
89+
<li>you can use a * or ? symbol as the first character of a search
90+
(unless not enabled using indexer option -a).</li>
8691
<li>to do a fuzzy search(find words similar in spelling, based on the
8792
Levenshtein Distance, or Edit Distance algorithm) use the tilde,
8893
"<b>~</b>", e.g. rcs~ </li>
@@ -101,7 +106,7 @@ A <dfn>Query</dfn> is a series of clauses. A clause may be prefixed by:</p>
101106
<a id="escaping"><dfn>Escaping special characters:</dfn></a>
102107
<p>Opengrok supports escaping special characters that are part of the query
103108
syntax. Current special characters are:<br/>
104-
<b>+ - &amp;&amp; || ! ( ) { } [ ] ^ " ~ * ? : \ </b><br/>
109+
<b>+ - &amp;&amp; || ! ( ) { } [ ] ^ " ~ * ? : \ / </b><br/>
105110
To escape these character use the \ before the character. For example to search
106111
for <b>(1+1):2</b> use the query: <b>\(1\+1\)\:2</b>
107112
</p>

0 commit comments

Comments
 (0)