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 Jeremy Glesner <je...@bericotechnologies.com> on 2016/08/22 18:42:15 UTC

Text field matching

Good day,

I'm trying to get my head wrapped around one of the fundamental aspects of
Lucene ... whether or not I need to index the document a certain way in
order to query it the way I want.  I'm inserting documents using a
Whitespace Tokenizer to process content into a Lucene 5.4.1 index.  Here's
what I want to do:

I have a single fuzzy term, such as "bostn~", and I want to query a text
field. Using a AnalyzingQueryParser, each of the tokens that comprise this
text field are individually matched against "bostn~".  Instead, I want a
query that treats the text field as a single string, not separate tokens
that are each compared to "bostn~".

Is there a way (Query type?) to achieve this, without having to change my
indexing technique?

I greatly appreciate your time,

Jeremy

Re: Text field matching

Posted by Adrien Grand <jp...@gmail.com>.
Maybe you should build the FuzzyQuery manually instead of making it go
through a query parser?

Le lun. 22 août 2016 à 20:42, Jeremy Glesner <je...@bericotechnologies.com>
a écrit :

> Good day,
>
> I'm trying to get my head wrapped around one of the fundamental aspects of
> Lucene ... whether or not I need to index the document a certain way in
> order to query it the way I want.  I'm inserting documents using a
> Whitespace Tokenizer to process content into a Lucene 5.4.1 index.  Here's
> what I want to do:
>
> I have a single fuzzy term, such as "bostn~", and I want to query a text
> field. Using a AnalyzingQueryParser, each of the tokens that comprise this
> text field are individually matched against "bostn~".  Instead, I want a
> query that treats the text field as a single string, not separate tokens
> that are each compared to "bostn~".
>
> Is there a way (Query type?) to achieve this, without having to change my
> indexing technique?
>
> I greatly appreciate your time,
>
> Jeremy
>