Index: trunk/lucene-search-2/.project |
— | — | @@ -1,6 +1,6 @@ |
2 | 2 | <?xml version="1.0" encoding="UTF-8"?> |
3 | 3 | <projectDescription> |
4 | | - <name>search-2.0</name> |
| 4 | + <name>search-trunk</name> |
5 | 5 | <comment>JavaCC Nature</comment> |
6 | 6 | <projects> |
7 | 7 | </projects> |
Index: trunk/lucene-search-2/src/org/wikimedia/lsearch/test/WikiQueryParserTest.java |
— | — | @@ -64,6 +64,12 @@ |
65 | 65 | |
66 | 66 | q = parser.parseRaw("+eggs incategory:breakfast"); |
67 | 67 | assertEquals("+contents:eggs +category:breakfast",q.toString()); |
| 68 | + |
| 69 | + q = parser.parseRaw("+eggs incategory:\"two_words\""); |
| 70 | + assertEquals("+contents:eggs +category:\"two words\"",q.toString()); |
| 71 | + |
| 72 | + q = parser.parseRaw("+eggs incategory:\"two words\""); |
| 73 | + assertEquals("+contents:eggs +category:\"two words\"",q.toString()); |
68 | 74 | |
69 | 75 | q = parser.parseRaw("help:making breakfast"); |
70 | 76 | assertEquals("+help:making +help:breakfast",q.toString()); |
Index: trunk/lucene-search-2/src/org/wikimedia/lsearch/analyzers/FastWikiTokenizerEngine.java |
— | — | @@ -637,7 +637,7 @@ |
638 | 638 | // don't add token to get syntax like [[bean]]s |
639 | 639 | continue; |
640 | 640 | case CATEGORY: |
641 | | - categories.add(new String(buffer,0,length)); |
| 641 | + categories.add(new String(buffer,0,length).replace("_"," ")); |
642 | 642 | length = 0; |
643 | 643 | fetch = FetchState.WORD; |
644 | 644 | // index category words |
Index: trunk/lucene-search-2/src/org/wikimedia/lsearch/analyzers/WikiQueryParser.java |
— | — | @@ -402,9 +402,10 @@ |
403 | 403 | (namespacePolicy == NamespacePolicy.IGNORE || |
404 | 404 | namespacePolicy == NamespacePolicy.REWRITE)) |
405 | 405 | return new Term(defaultField,t); |
406 | | - else if(field.equals("incategory")) |
407 | | - return new Term("category",builder.isExactCase()? t : t.toLowerCase()); |
408 | | - else |
| 406 | + else if(field.equals("incategory")){ |
| 407 | + String norm = t.replace("_"," "); // per bug 10822 |
| 408 | + return new Term("category",builder.isExactCase()? norm : norm.toLowerCase()); |
| 409 | + } else |
409 | 410 | return new Term(field,t); |
410 | 411 | } |
411 | 412 | |