lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Svein Parnas <>
Subject Re: exact field match
Date Mon, 26 Jan 2009 22:08:39 GMT
Another solution is to put a special token in front and end of every  
occurence of the field, eg aastartaa in front an zzendzz in the end (a  
solution looking like Fasts boundary match feature behind the hood),  
You could then search for exact match ("aastartaa your phrase  
zzendzz"), and you would also get support for 'begins  
with' ("aastartaa your phrase"), 'ends with' ("your phrase zzendzz")  
and, if you need it, boosting of short field values ("aastartaa your  
phrase zzendzz"~10000) - a feature several others have been asking for  
earlier on on this list.


On 26. jan.. 2009, at 20.29, Erick Erickson wrote:

> You need to index and search using something like
> KeywordAnalyzer. That analyzer does no tokenizing/
> data transformation or such. For instance, it
> doesn't fold case.
> You will be unable to search for "bond" and get a hit
> in this case, so one solution is to use two fields, and
> search one or the other depending upon your needs.
> e.g.
> myField
> myFieldTokenized
> Each field gets a complete copy of the data, and you search
> "myField" in the case you're describing and
> myFieldTokenized when you want to match on "bond".
> Of course, if you never want a hit on "bond", you don't need the
> Tokenized field.
> Best
> Erick
> On Mon, Jan 26, 2009 at 2:15 PM, Antonio Zippo <>  
> wrote:
>> Hi all,
>> i'm using a string field named "myField"
>> and 2 documents containing:
>> 1. myField="my name is james bond"
>> 2. myField="james bond"
>> if i use a query like this:
>> myField:"james bond" it returns 2 documents....
>> how can i get only the second document using a string or text  
>> field? I need
>> to search the document with the exact value....nor documents  
>> containing the
>> exact phrase in value
>> thanks in advance

View raw message