lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matthew Hall <>
Subject Re: Using AND with MultiFieldQueryParser
Date Thu, 13 Nov 2008 17:12:17 GMT
Which Analyzer have you assigned per field?

The PerFieldAnalyzerWrapper uses a default analyzer (the one you passed 
during its construction), and then you assign specific analyzers to each 
field that you want to have special treatment.

For example:

        PerFieldAnalyzerWrapper aWrapper = new PerFieldAnalyzerWrapper(
                new StandardAnalyzer());
        aWrapper.addAnalyzer("data", new MGIAnalyzer());
        aWrapper.addAnalyzer("sdata", new StemmedMGIAnalyzer());

Now, for the fields in question, have you assigned an Analyzer that 
doesn't actually use stopwords? (there are several available in core)  
Or are you perchance using a custom Analyzer that doesn't process stop 

Could you possibly post your Initialization code for this?  If so I 
think we could be of more help to you.


Rafael Cunha de Almeida wrote:
> On Thu, 13 Nov 2008 14:53:59 +0530
> "prabin meitei" <> wrote:
>> Hi,
>> From whatever you have written you are trying to write a query
>> *word1 AND stopword AND word2
>> *this means that the result should contain all of word1, word2 and the
>> stopword.
>> Since you have already removed the stopword during index time you will never
>> find any document matching your query. (this is expected behaviour)
>> you can possibly use word1 OR stopword OR word2 (depends on what you want in
>> the result)
>>  If you can clarify more about what you want in the result we can discuss on
>> what can be done.
> I wanted MultiFieldQueryParser to ignore any stopword the user may type
> in. In that particular case I'd like the result to be word1 AND word2. I
> thought that was what would happen because I pass the Analyzer to
> MultiFieldQueryParser, so I expected the parser to ignore stopwords for
> fields which the analyzer drops stopwords (I use PerFieldAnalyzerWrapper
> analyzer).
>> On Thu, Nov 13, 2008 at 10:30 AM, Rafael Cunha de Almeida <
>>> wrote:
>>> Hello,
>>> I used an Analyzer which removes stopwords when indexing, then I wanted
>>> to do an AND search using MultiFieldQueryParser. So I did this:
>>>        word1 AND stopword AND word2
>>> I thought the stopword would be ignored by the searcher (I use the same
>>> Analyzer to index and search). But instead, I get no results whenever I
>>> have a stopword like that. If I remove the stopword, giving me:
>>>        word1 AND word2
>>> then the search is sucessful. Is that the expected behaviour? Am I
>>> doing something wrong?
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail:
>>> For additional commands, e-mail:
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message