QueryParser and Field.Keyword fields are a strange mix. For some background, check the archives as this has been covered pretty extensively.

A quick answer is yes you can use MFQP and QP with keyword fields, however you need to be careful which analyzer you use. PerFieldAnalyzerWrapper is a good solution - you'll just need to use an analyzer for your keyword field which simply tokenizes the whole string as one chunk. Perhaps such an analyzer should be made part of the core?

Erik

On Mar 23, 2004, at 12:58 PM, Chad Small wrote:

I have since learned that using the TermQuery instead of the MultiFieldQueryParser works for the keyword field in question below (HW-NCI_TOPICS).

apiQuery = new BooleanQuery();
apiQuery.add(new TermQuery(new Term("category", "HW-NCI_TOPICS")), true, false);


This finds a match.

I found a message that talked about having to use the the Query API when searching Keyword fields in the index. Is this true?

Is there not a way to get the MultiFieldQueryParser to find a match on this keyword?

thanks,
chad.

        -----Original Message-----
        From: Chad Small
        Sent: Tue 3/23/2004 10:57 AM
        To: [EMAIL PROTECTED]
        Cc:
        Subject: Query syntax on Keyword field question
        
        

        Hello,
        
        How can I format a query to get a hit?
        
        I'm using the StandardAnalyzer() at both index and search time.
        
        If I'm indexing a field like this:
        
        luceneDocument.add(Field.Keyword("category","HW-NCI_TOPICS"));
        
        I've tried the following with no success:
        
        //      String searchArgs = "HW\\-NCI_TOPICS";
        //      String searchArgs = "HW\\-NCI_TOPICS".toLowerCase();
        //      String searchArgs = "+HW+NCI+TOPICS";
              //this works with .Text field
        //      String searchArgs = "+hw+nci+topics";
        //      String searchArgs = "hw nci topics";
        
        thanks,
        chad.
        

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to