What you're asking for appears to me to be "auto-categorization", and there's nothing built into Solr to do this. Somehow you need to analyze the documents at index time and add the proper categories, but I have no clue how. This is especially hard with short fields since most auto-categorization algorithms try to do some statistical analysis of the document to figure this out.
Best Erick On Thu, Dec 23, 2010 at 8:12 AM, Hasnain <hasn...@hotmail.com> wrote: > > Hi all, > > I am using solr in my web application for search purposes. However, i > am having a problem with the default behaviour of the solr search. > > From my understanding, if i query for a keyword, let's say "Laptop", > preference is given to result rows having more occurences of the search > keyword "Laptop" in the field "name". This, however, is producing > undesirable scenarios, for example: > > 1. I index an item A with "name" value "Sony Laptop". > 2. I index another item B with "name" value: "Laptop bags for laptops". > 3. I search for the keyword "Laptop" > > According to the default behaviour, precedence would be given to item B > since the keyword appears more times in the "name" field for that item. > > In my schema, i have another field by the name of "Category" and, for > example's sake, let's assume that my application supports only two > categories: computers and accessories. Now, what i require is a mechanism > to > assign correct categories to the items during item indexing so that this > field can be used to better filter the search results, item A would belong > to "Computer" category and item B would belong to "Accessories" category. > So > then, searching for "Laptop" would only look for items in the "Computers" > category and return item A only. > > I would like to point out here that setting the category field manually is > not an option since the data might be in the vicinity of thousands of > records. I am not asking for an in-depth algorithm. Just a high level > design > would be sufficient to set me in the right direction. > > thanks. > > > -- > View this message in context: > http://lucene.472066.n3.nabble.com/Item-catagorization-problem-tp2136415p2136415.html > Sent from the Solr - User mailing list archive at Nabble.com. >