The Solr Wildcard Problem And Multiterm Solution

A while ago I ran into a problem with Solr and wildcard searches. Turns out it's more of a little known fact than a problem, Solr treats wildcards a bit different than how one would expect.

Normally, when a user enters a search-term we will append '*' to it so it will find words starting with the term that is being searched for. Common sense dictates that when someone searches for "train*", the set of results will also contain the word "train" itself. But "train" is not part of the results. When looking for "train*" Solr will return "trainer", "training", "trains" but it won't return results with the word "train" in it.

In case you want documents matching the exact word as well you will have to change your Solr statement. Instead of searching for "word*" you'll have to look for "word OR word*", only then documents matching "word" will turn up in the result-set.

After discussing it with Nick Veenhof, it turns out that, as of Solr 3.6 there's been a new type of analyser introduced that addresses this shortcoming (although it seems to be more of a side-effect). The multiterm analyser type. Copy the query analyzer section of the text fieldType and change the type to "multiterm". What multiterm addresses is that when you look for "train*" it will run the query as if you've been searching for "train", "trains", "training", "trainer". You might be inclined to think that that's the same as searching for anything that starts with "train", but that is not the case. Without specifying the multiterm analyser the wildcard searches are not analysed at all and thus can't be used for stemming, or downcasing or accent mapping...

Specifying the new multiterm analyser will also "expand" the wildcard search to the actual word, in our case "train", which is what we were looking for.

In case you're using Drupal to interface with Solr there's an issue filed about this along with a simple example explaining the difference between a non-analysed wildcard search and a multiterm search.

Comments

When looking for "train*" Solr will return "trainer", "training", "trains" but it won't return results with the word "train" in it. I am gald to find this article. hi!,I really like your writing very so much! share we keep in touch more about your post on AOL? I require an expert on this house to unravel my problem. May be that’s you! Taking a look ahead to look you. http://www.bestdvdland.com/

Wow..... Really informative blog article.
Spokane Video Weddings

New music instruction commonly starts with elementary educational institutions where little ones are taught the best way to play instruments such as keyboard, play in choirs or maybe school represents, and discover more about the things and heritage of new music. In school, music education may continue as part of the curriculum. neighborhoodacademyofmusic.net

instruction commonly starts with elementary educational institutions where little ones are taught the best way to play instruments such as keyboard, play in choirs or maybe school represents Get Traffic

This is a nice post in an interesting line of content.Thanks for sharing this article, great way of bring this topic to discussion.
SEO Manchester

Roller Shutters
Hi, just wanted to say I attended this conference last year, and found it by far the best of about 8 conferences that I attended in the field. Full of professional insight based on testing by experts that knew what they were talking about. I would certain

I researed valuable information on this point as I am working on a class project. Thank you posting useful information and its now becoming easier to accomplish this task.
best fish oil

In case you want documents related the complete concept likewise you'll have to transform your current Solr declaration. As opposed to seeking "word*" you must search for "word AS WELL AS word*", merely then documents related "word" will certainly generate from the result-set. purple wedding flowers can be a great colour pertaining to wedding party plants. It may are the palest lavender with a vibrant pink with a royal eggplant tone, plus a huge variety of plants can be bought in pink. Through candelabras in order to blossoms in order to blossom ladies, these include many of the lovliest pink wedding party plants.

You may post on the professional credentials for the blog owner. You could express it's outstanding. Your blog experience can springboard your click through.

Its a great pleasure reading your post.Its full of information I am looking for and I love to post a comment that "The content of your post is awesome" Great work

Learn what steps to take in order to save money during a recession. Are there ways of saving money during a recession? Recession is a word that has a negative meaning for many people; it fills many people full of a dreadful fear of loss. People are scared that it means www.financialaidaudit.com

Massage Tucson
Innovation has nothing to do with how many R amp&; D dollars you have. When Apple came up with the Mac, IBM was spending at least 100 times more on R & D. It's not about money. It's about the people you have, how you're led, and how much you get it.

In case you want documents matching the exact word as well you will have to change your Solr statement. Instead of searching for "word*" you'll have to look for "word OR word*", only then documents matching "word" will turn up in the result-set.

Most Popular Websites

Your article has piqued a lot of positive interest. I can see why since you have done such a good job of making it interesting.
how to unlock iphone 4 when disabled

It is good to see the consumer sales of furniture up in the United States, but it is also unfortunate because all of this furniture isn't made in the US anymore. All we're doing is adding to the deforestation of Southeast Asia and the trade deficits here the United States. No, we don't live in a perfect world, www.furnituresaleillinois.com

Find Inspiring Quotes On Facebook. It's Quick, Easy & Free. Join Now!
arabchat

I definitely enjoying every little bit of it. It is a great website and nice share. Jual Mobil Hotwheels

One secret of success in life is for a man to be ready for his opportunity when it comes.
Peter J. Burns III

Flaming enthusiasm, backed up by horse sense and persistence, is the quality that most frequently makes for success.
amber teething necklace

Success is getting what you want. Happiness is wanting what you get.
mobilieji telefonai

Great job for publishing such a beneficial web site. Your web log isn’t only useful but it is additionally really creative too. There tend to be not many people who can certainly write not so simple posts that artistically. Continue the nice writing
double stroller reviews

Buying cost helpful tour package to have some stress-free time off from your each day routine? We during cheap family vacation package understand the additional value of your hard earned money and offer array with cheap go deals. incredibleholiday.net

When everything else physical and mental seems to diminish, the appreciation of beauty is on the increase.
Timber Merchants Liverpool

Your website is really cool and this is a great inspiring article. Thank you so much.
medical alert bracelets

Admiring the time and effort you put into your blog and detailed information you offer!..
best electric razor

When your trucks cart goods all over town or within the nation, you must protect a person's drivers, cars or trucks, and others on the streets. Since a person's trucks plus vans go multiple miles on a daily basis, you want fairly in depth commercial insurance. insuranceconnectionsinc.net

There is no question that instantaneous water heaters are good options to trust in terms of their water heating services. However, you need to know that not all kinds of this water heater will work best for you.
Tablet Covers

We live in a wonderful world that is full of beauty, charm and adventure. There is no end to the adventures that we can have if only we seek them with our eyes open.
Buy Facebook Fans

When everything else physical and mental seems to diminish, the appreciation of beauty is on the increase.
Double Glazing Preston

What beauty is, I know not, though it adheres to many things.
Roller Shutters

Lots of people think that with the ability to get from the obsession from drugs plus alcohol set up. When they practice light converse and would make conversations about these materials, they currently have always implanted on the minds that it usually is done simple and fast. kernicterus-law.net

This article helps me a lot. It is useful. Your content is brilliant in my opinion. I think this is engaging and eye-opening material. I hope you will continue writing such a great articles.SEO Liverpool

You ability be likely to imagine that that's the ditto as searching for anything that originates along "trail", besides that is hardly the case. Minus specifying the multiterm analyser the wildcard searches are nay analysed at many besides thus can't be worn for stemming, or downcasing or dialect mapping... try this

I have been curious about this topic and decided to do some research. Your article has some useful information. Do you have any more on this subject?
online proxy

The first time I came here, less than 10 seconds the display is perfectly open, and the loading is completed less than 20 seconds and to open the article only took about 7 seconds. So I think this is very fast! Incredible! Trying to maintain!
Timber Merchants Manchester

You must know by now, your article goes to the nitty-gritty of the subject. Your clarity leaves me wanting to know more. Just so you know, i will immediately grab your feed to keep up to date with your online blog. Sounding Out thanks is simply my little
Double Glazing Blackpool

Thank you for this post. Thats all I are able to say. You most absolutely have built this blog website into something speciel. You clearly know what you are working on, youve insured so many corners.thanks
Franchises UK

Buy Cipro
Hi, Kas. I doubt that you summarized the paper correctly. You say they found patterns in the DNA, but they do not, as I see, deal with DNA at all, they deal with the genetic code.

Innovation has nothing to do with how many R amp&; D dollars you have. When Apple came up with the Mac, IBM was spending at least 100 times more on R & D. It's not about money. It's about the people you have, how you're led, and how much you get it. Kata kata , kata kata lucu , kata kata bijak , kata kata cinta , kata kata mutiara, kata kata romantis
, kebun

Online Pharmacy
Nice information, many thanks to the author. I believe that anyone who wants to know something about this topic will like the post.I really loved reading blog.

NARROLASH™ is the most versatile and flexible of all non-metallic lashing. It is one of the safest and most cost effective alternatives to steel strapping, chains, wire ropes and ratchet strapping.
tie downs

Your site looks really amazing
I need college homework help

Defeat is not the worst of failures. Not to have tried is the true failure.Provigil Online

This is a very good solution as far as i think. http://familyissuesonline.net

Computers themselves, and software yet to be developed, will revolutionize the way we learn.
toronto ibogaine centre

horizontal baler
Belief in oneself is one of the most important bricks in building any successful venture.

Fascinating piece, illustrated best by the main point. Good post, keep it up. SEO Manchester

Pages