[ 
https://issues.apache.org/jira/browse/JSPWIKI-501?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18135747#comment-18135747
 ] 

Arturo Bernal commented on JSPWIKI-501:
---------------------------------------

I checked this on current master with LuceneSearchProvider (default 
ClassicAnalyzer), using a page named Page_WithUnderscore whose text contains 
snake_case_term. Results of the search:

- Page_WithUnderscore: finds the page
- snake_case_term: finds the page
- Page*, snake* and WithUnderscore: find the page
- Page_*: finds nothing
- snake_*: finds nothing

So the report still reproduces for wildcard searches that include the 
underscore; searches for the complete term work. A likely explanation, not 
verified by looking into the index, is that the analyzer splits 
Page_WithUnderscore into page and withunderscore, and wildcard terms are not 
analyzed, so no indexed term starts with page_.

Two ways to change it, neither implemented: make the underscore part of the 
tokens in the analyzer, which changes the indexing of every page and needs a 
reindex, or rewrite the wildcard term before the query, which returns more 
results than asked for. I have not decided between them; the first one changes 
the behaviour for everybody who uses the default analyzer.

> Search Cannot Find Terms With Underscores
> -----------------------------------------
>
>                 Key: JSPWIKI-501
>                 URL: https://issues.apache.org/jira/browse/JSPWIKI-501
>             Project: JSPWiki
>          Issue Type: Bug
>          Components: Core & storage
>    Affects Versions: 2.8.2
>         Environment: Red Hat Linux
>            Reporter: Stefan Bohn
>            Priority: Minor
>              Labels: pull-request-available
>
> http://www.jspwiki.org/wiki/BugSearchCannotFindTermsWithUnderscores
> I want to re-open this bug.
> We have many pages with a underscore in the pagename. These pages could not 
> be found with Lucene, when the underscore is entered in the searchbox.
> Example:
> Pagename: Page_WithUnderscore
> Searchstring: Page* - search is ok
> Searchstring Page_* page is not listed in the search result
> Is this a bug, or must I change the search string, because of Lucene?



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to