lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <Tim.Wri...@informa.com>
Subject Searching for "keyword" fields using QueryParser
Date Thu, 24 Nov 2005 14:09:48 GMT
Hi,

Our index has a large text field, and a number of "keyword" fields with
things such as the publication code, article reference and so on. 

We're analysing using the StandardAnalyzer, which works well. Obviously
the fields which are defined as Field.Keyword don't run through the
analyzer. 

The problem comes when we search using a QueryParser. If we've inserted
a field using:

Field.Keyword("pubcode"."PUB123");

We then search using 

Query q = QueryParser.parse(query, "text", new StandardAnalyzer());

When we try to search on something like:

"pubcode:PUB123" - the analyzer promptly lowercases the search term, and
we get no hits back. 

Is there any way to explain that where a search term is being applied
against a field of type Keyword, that it shouldn't be run through the
analyzer? 

We can get around this by creating separate Query objects and joining
them with a BooleanQuery, but we were hoping to be able to handle all of
our queries using QueryParser so that we could easily store queries as
String objects. 

Cheers,

Tim.



********************************************************************************
The information contained in this email message may be confidential. If you are not the intended
recipient, any use, interference with, disclosure or copying of this material is unauthorised
and prohibited. Although this message and any attachments are believed to be free of viruses,
no responsibility is accepted by Informa for any loss or damage arising in any way from receipt
or use thereof.  Messages to and from the company are monitored for operational reasons and
in accordance with lawful business practices. 
If you have received this message in error, please notify us by return and delete the message
and any attachments.  Further enquiries/returns can be sent to postmaster@informa.com


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message