You can identify what words are the city name at index time, because they're the ones in the "city" field, right? So why not just strip those words out at index time? Create a new field, name_search, and search on that, not name.
Doc 1 name => "Holiday Inn" name_search => "Holiday Inn" [analyzed, perhaps lowercase normalized etc] city => "Denver" Doc 2 name => "Holiday Inn, Denver" name_search => "Holiday Inn" city => "Denver" Jonathan ________________________________________ From: Matt Mitchell [goodie...@gmail.com] Sent: Tuesday, October 12, 2010 9:24 AM To: solr-user@lucene.apache.org Subject: Re: dynamic "stop" words? Thanks for the feedback. I thought about stop words but since I have a lot of documents spanning lots of different countries, I won't know all of the possible cities so stop-words could get hard to manage. Also, the city name is in the same field. I think I might try creating a new field called name_no_city, and at index time just strip the city name out? Matt On Sat, Oct 9, 2010 at 11:17 AM, Geert-Jan Brits <gbr...@gmail.com> wrote: > That might work, although depending on your use-case it might be hard to > have a good controlled vocab on citynames (hotel metropole bruxelles, hotel > metropole brussels, hotel metropole brussel, etc.) Also 'hotel paris > bruxelles' stinks... > > given your example: > >> Doc 1 >> name => "Holiday Inn" >> city => "Denver" >> >> Doc 2 >> name => "Holiday Inn, Denver" >> city => "Denver" >> >> q=name:(Holiday Inn, Denver) > > turning it upside down, perhaps an alternative would be to query on: > q=name:Holiday Inn+city:Denver > > and configure field 'name' in such a way that doc1 and doc2 score the same. > I believe that must be possible, just not sure how to config it exactly at > the moment. > > Of course, it depends on your scenario if you have enough knowlegde on the > clientside to transform: > q=name:(Holiday Inn, Denver) to q=name:Holiday Inn+city:Denver > > Hth, > Geert-Jan > > 2010/10/9 Otis Gospodnetic <otis_gospodne...@yahoo.com> > >> Matt, >> >> The first thing that came to my mind is that this might be interesting to >> try >> with a dictionary (of city names) if this example is not a made-up one. >> >> >> Otis >> ---- >> Sematext :: http://sematext.com/ :: Solr - Lucene - Nutch >> Lucene ecosystem search :: http://search-lucene.com/ >> >> >> >> ----- Original Message ---- >> > From: Matt Mitchell <goodie...@gmail.com> >> > To: solr-user@lucene.apache.org >> > Sent: Fri, October 8, 2010 11:22:36 AM >> > Subject: dynamic "stop" words? >> > >> > Is it possible to have certain query terms not effect score, if that >> > same query term is present in a field? For example, I have an index of >> > hotels. Each hotel has a name and city. If the name of a hotel has the >> > name of the city in it's "name" field, I want to completely ignore >> > that and not have it influence score. >> > >> > Example: >> > >> > Doc 1 >> > name => "Holiday Inn" >> > city => "Denver" >> > >> > Doc 2 >> > name => "Holiday Inn, Denver" >> > city => "Denver" >> > >> > q=name:(Holiday Inn, Denver) >> > >> > I'd like those docs to have the same score in the response. I don't >> > want Doc2 to have a higher score, just because it has all of the query >> > terms. >> > >> > Is this possible without using stop words? I hope this makes sense! >> > >> > Thanks, >> > Matt >> > >> >