Uploaded image for project: 'Lucene.Net'
  1. Lucene.Net
  2. LUCENENET-587

Getting ScoreDocs count zero when i use PhraseQuery

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Not A Problem
    • Lucene.Net 3.0.3
    • None
    • .NET API
    • None
    • .net

    Description

      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.

      Attachments

        Activity

          People

            Unassigned Unassigned
            veerababu.vaka@ptgindia.com Veerababu
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: