can you tell us more about your index side of things? Are you using positions in the index since I see PhraseQuery in your code? Where are you passing the text you are searching for to the BrasilianAnalyzer, I don't see it in your code. You need to process you text at search time too to get results.
simon On Wed, Jul 11, 2012 at 5:32 PM, Marcelo Neves <marcelo.ne...@xgen.com.br>wrote: > Hi all,**** > > ** ** > > I create a method above que generate my boolean query based in many > parameters. The query's on not analyzed fields works perfect in debug.**** > > When start a search using any analyzed field with BrazilianAnalyzer, > always a return empty result (zero docs). I do test in separeted solution > with a unique field with Brazilian Analyzer in indexing and searching. If > use a BooleanQuery and not queryparse, don't works as expected. Return > empty result.**** > > When change for StandardAnalyzer on Indexing and Serching, without alter > other parts of code, works. **** > > ** ** > > Could anyone help me?**** > > [Code]**** > > ** ** > > protected virtual BooleanQuery GetExpressionBooleanQuery(string > searchExpression, SearchModeEnum searchMode, bool searchDocumentHistory, > bool onlyDocumentHistory)**** > > {**** > > if (string.IsNullOrEmpty(searchExpression))**** > > {**** > > return null;**** > > }**** > > ** ** > > BooleanQuery queryWords = new BooleanQuery();**** > > PhraseQuery phrase = new PhraseQuery();**** > > string[] expressions = null;**** > > ** ** > > expressions = searchExpression.ToLower().Replace("\"", > "").Split(' ');**** > > for (int i = 0; i < expressions.Length; i++)**** > > {**** > > if > (!string.IsNullOrEmpty(expressions[i].Trim()))**** > > {**** > > if (expressions.Length > 1) > **** > > {**** > > switch > (searchMode)**** > > {**** > > > case SearchModeEnum.ExactPhrase:**** > > > if (!onlyDocumentHistory)**** > > > {**** > > > phrase.Add(new Term(ColumnsIndexedDocuments.COLUMN_DOCUMENTCONTENT, > expressions[i].Trim()), i);**** > > > }**** > > > if (searchDocumentHistory)**** > > > {**** > > > phrase.Add(new Term(ColumnsIndexedDocuments.COLUMN_DOCUMENTCONTENT_NODEXML, > expressions[i].Trim()), i);**** > > > }**** > > > break;**** > > > case SearchModeEnum.AnyWord:**** > > > if (!onlyDocumentHistory)**** > > > {**** > > > queryWords.Add(new BooleanClause(new TermQuery(new > Term(ColumnsIndexedDocuments.COLUMN_DOCUMENTCONTENT, > expressions[i].Trim())), BooleanClause.Occur.SHOULD));**** > > > }**** > > > if (searchDocumentHistory)**** > > > {**** > > > > queryWords.Add(new BooleanClause(new TermQuery(new > Term(ColumnsIndexedDocuments.COLUMN_DOCUMENTCONTENT_NODEXML, > expressions[i].Trim())), BooleanClause.Occur.SHOULD));**** > > > }**** > > > break;**** > > > case SearchModeEnum.AllWords:**** > > > if (!onlyDocumentHistory)**** > > > {**** > > > queryWords.Add(new BooleanClause(new TermQuery(new > Term(ColumnsIndexedDocuments.COLUMN_DOCUMENTCONTENT, > expressions[i].Trim())), BooleanClause.Occur.MUST));**** > > > }**** > > > if (searchDocumentHistory)**** > > > {**** > > > queryWords.Add(new BooleanClause(new TermQuery(new > Term(ColumnsIndexedDocuments.COLUMN_DOCUMENTCONTENT_NODEXML, > expressions[i].Trim())), BooleanClause.Occur.MUST));**** > > > }**** > > > break;**** > > > default:**** > > > break;**** > > }**** > > }**** > > else**** > > {**** > > if > (!onlyDocumentHistory)**** > > {**** > > > queryWords.Add(new BooleanClause(new TermQuery(new > Term(ColumnsIndexedDocuments.COLUMN_DOCUMENTCONTENT, > expressions[i].Trim())), BooleanClause.Occur.MUST));**** > > }**** > > if > (searchDocumentHistory)**** > > {**** > > > queryWords.Add(new BooleanClause(new TermQuery(new > Term(ColumnsIndexedDocuments.COLUMN_DOCUMENTCONTENT_NODEXML, > expressions[i].Trim())), BooleanClause.Occur.MUST));**** > > }**** > > }**** > > }**** > > }**** > > if (phrase.GetTerms().Length > 0)**** > > {**** > > queryWords.Add(new BooleanClause(phrase, > BooleanClause.Occur.MUST));**** > > }**** > > return queryWords;**** > > }**** > > ** ** > > [/Code]**** > > ** ** > > I wait for help. Please!**** > > ** ** > > Thanks!**** > > ** ** > > [image: Descrição: marcelo-neves]**** > > ** ** >