You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by Spence Nichols <sp...@yahoo.co.uk> on 2002/11/14 19:36:10 UTC

How do I stop the QueryParser from tokenising fields?

Hi

I have created an index which has documents with many fields.

Eg Field.Keyword("AUTHOR", "Fred Bloggs") - want it indexed and stored, not
tokenised
   Field.Text("CONTENT", "Example content")

The second field will get tokenised/analysed using my Analyser.

When trying to search the index I build a Query object using the QueryParser
and my analyser.  The result is the query gets tokenised/analysed for each
field.

So if I enter a search of: Fred Bloggs

How can I build a query where only the CONTENT field term gets tokenised?

(AUTHOR:Fred AUTHOR:Bloggs) (CONTENT:fred CONTENT:blogg)

Any help appreciated
Spence


__________________________________________________
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: How do I stop the QueryParser from tokenising fields?

Posted by Otis Gospodnetic <ot...@yahoo.com>.
Heh, funny :)
Look at the jGuru Lucene FAQ for building a custom Analyzer.
Your Analyzer has to treat some of your fields differently.

Otis

--- Spence Nichols <sp...@yahoo.co.uk> wrote:
> Hi
> 
> I have created an index which has documents with many fields.
> 
> Eg Field.Keyword("AUTHOR", "Fred Bloggs") - want it indexed and
> stored, not
> tokenised
>    Field.Text("CONTENT", "Example content")
> 
> The second field will get tokenised/analysed using my Analyser.
> 
> When trying to search the index I build a Query object using the
> QueryParser
> and my analyser.  The result is the query gets tokenised/analysed for
> each
> field.
> 
> So if I enter a search of: Fred Bloggs
> 
> How can I build a query where only the CONTENT field term gets
> tokenised?
> 
> (AUTHOR:Fred AUTHOR:Bloggs) (CONTENT:fred CONTENT:blogg)
> 
> Any help appreciated
> Spence
> 
> 
> __________________________________________________
> Do You Yahoo!?
> Everything you'll ever need on one web page
> from News and Sport to Email and Music Charts
> http://uk.my.yahoo.com
> 
> --
> To unsubscribe, e-mail:  
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> 


__________________________________________________
Do you Yahoo!?
Yahoo! Web Hosting - Let the expert host your site
http://webhosting.yahoo.com

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>