lucenenet-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Singaravelu (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (LUCENENET-595) Wildcard search with special characters "#" not working
Date Mon, 04 Sep 2017 10:31:02 GMT

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

Singaravelu commented on LUCENENET-595:
---------------------------------------

Hi Shad,

Thanks for your immediate response and the suggestions.

I have tried with WhitespaceAnalyzer, unfortunately it didn't worked. 
Then I have created my own Analyzer using the WhitespaceTokenizer and it wroked.

Thanks once again.
Singaravelu

> Wildcard search with special characters "#" not working
> -------------------------------------------------------
>
>                 Key: LUCENENET-595
>                 URL: https://issues.apache.org/jira/browse/LUCENENET-595
>             Project: Lucene.Net
>          Issue Type: Bug
>          Components: Lucene.Net Core
>    Affects Versions: Lucene.Net 3.0.3
>            Reporter: Singaravelu
>            Priority: Blocker
>
> I'm using Lucene.Net 3.0.3.0 version in my website to search list of courses.
> I have few courses which contains the special character "#" like, C#, C#.Net, etc.
> But When I search with the term "C#" it showing 0 results.
> I'm using StandardAnalyzer and MultiFieldQueryParser also allowing wildcard search (AllowLeadingWildcard
= true).
> Here is my code:
> var analyzer = new StandardAnalyzer(Version.LUCENE_30, stopWords);
> {
> BooleanQuery query = new BooleanQuery();
> var nameParser = new MultiFieldQueryParser(Version.LUCENE_30, new[] { "Column1", " Column2",
" Column3" }, analyzer);
> if (!string.IsNullOrEmpty(searchCriteria.CourseName))
> {
> query.Add(parseQuery(GetTerms(searchCriteria.CourseName.ReplaceDiacritics()), nameParser),
Occur.MUST);
> }
> ScoreDoc[] hits = searcher.Search(query, null, hits_limit, Sort.RELEVANCE).ScoreDocs;
> var results = _mapLuceneToDataList(hits, searcher);
> analyzer.Close();
> searcher.Dispose();
> return results;
> }
> For indexing: 
> The word "C#" indexed and stored correctly. 
> doc.Add(new Field("Title", sampleData.CourseName, Field.Store.YES, Field.Index.ANALYZED));
> Kindly let me know what I have to do to retrieve the result when I search with the term
"C#".



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Mime
View raw message