One way is to add magic 'beginning' and 'end' terms, then do phrase searches with those terms.
On Wed, Mar 10, 2010 at 7:51 AM, Jan Høydahl / Cominvent <jan....@cominvent.com> wrote: > Hi, > > Sometimes you need to anchor your search to start/end of field. > > Example: > 1. title=New York Yankees > 2. title=New York > 3. title=York > > If I search title:"New York", or title:"York" I would get a match, but I'd > like to anchor my search to beginning and/or end of the field, e.g. with > regex syntax, title:"^New York$" > > Now, I know how to work-around this, by appending some unique character > sequence at each end of the field and then include this in my search in the > front end. However, I wonder if any of you have been planning a patch to add > a native boundary match feature to Solr that would automagically add tokens > (also for multi-value fields!), and expand the query language to allow > querying for starts-with(), ends-with() and equals() > > -- > Jan Høydahl, search solution architect > Cominvent AS - www.cominvent.com > Training in Europe - www.solrtraining.com > > -- Lance Norskog goks...@gmail.com