You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucenenet.apache.org by "Veerababu (JIRA)" <ji...@apache.org> on 2017/06/08 06:58:18 UTC

[jira] [Created] (LUCENENET-587) Getting ScoreDocs count zero when i use PhraseQuery

Veerababu created LUCENENET-587:
-----------------------------------

             Summary: Getting ScoreDocs count zero when i use PhraseQuery
                 Key: LUCENENET-587
                 URL: https://issues.apache.org/jira/browse/LUCENENET-587
             Project: Lucene.Net
          Issue Type: Bug
          Components: .NET API
    Affects Versions: Lucene.Net 3.0.3
         Environment: .net
            Reporter: Veerababu


Right now i am using below code to search.

 MultiFieldQueryParser multiParser = new MultiFieldQueryParser(Lucene.Net.Util.Version.LUCENE_30,
                    new[] { "EntityName", "EntityDesc", "EntityTranscript", "CourseSystemID", "Tags", "Objectives" },
                    new StandardAnalyzer(Lucene.Net.Util.Version.LUCENE_30));

                if (searchTerm.Contains("\""))
                {
                    multiParser.DefaultOperator = QueryParser.Operator.AND;
                }
                else
                {
                    multiParser.DefaultOperator = QueryParser.Operator.OR;
                }

                string parserTerm = ReplaceSpecialCharactersInSearchTerm(searchTerm);
                searchResults.Clear();

                // parse the query  
               Query query = multiParser.Parse(parserTerm);
                TopDocs results = searcher.Search(query, 20000);

Above code is working fine form , but if i give "Dynamcis 365 Enterprise" as search keyword it is bring resutls for each and every work match like , Dynamics word ,365 word match and Enterprise match. But my requirement is exact string("Dynamcis 365 Enterprise") match. 
To achieve this i have changed my code from parser to phrase query. But it is giving ScoreDocs count Zero.

Please hlep me on this how to achieve.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)