How to boost exact match?
Hi, We have a name field which I am boosting using dismax parser. I want the search to bring the documents that has exact match compared to partial match. Ex: doc1 Name:account /doc1 doc1 doc2 Name:account number /doc2 doc3 Name:account number - closed account /doc1 When I search for account number, I want solr to return the document containing Name:account number first followed by other documents but it doesnt seem to return that way.. Can someone please help? Thanks, Barani Thanks, Barani -- View this message in context: http://lucene.472066.n3.nabble.com/How-to-boost-exact-match-tp4015862.html Sent from the Solr - User mailing list archive at Nabble.com.
Re: How to boost exact match?
You neglected to show us your example queries and how you wanted to boost them. The simple answer is to supply multiple query terms with increasing level of detail (e.g., more terms in a quoted phrase) and apply a query boost that is higher for the more exact matches. If you don't get expected results, please detail precisely which results were not as expected and exactly why you found them to be unexpected. Add debugQuery=true to your query request to see how each document is being scored in the explain section. Sometimes that will offer clues as to what to focus boosting on. And finally, you may want to set a document boost at index time for some documents, or maybe define one or more extra fields with boost factors as their values at index time to be used in various query situations and then add a function query to your query to apply those document-specific boosts. Or, those fields could have simple booleans to trigger boost functions. -- Jack Krupansky -Original Message- From: bbarani Sent: Thursday, October 25, 2012 12:04 PM To: solr-user@lucene.apache.org Subject: How to boost exact match? Hi, We have a name field which I am boosting using dismax parser. I want the search to bring the documents that has exact match compared to partial match. Ex: doc1 Name:account /doc1 doc1 doc2 Name:account number /doc2 doc3 Name:account number - closed account /doc1 When I search for account number, I want solr to return the document containing Name:account number first followed by other documents but it doesnt seem to return that way.. Can someone please help? Thanks, Barani Thanks, Barani -- View this message in context: http://lucene.472066.n3.nabble.com/How-to-boost-exact-match-tp4015862.html Sent from the Solr - User mailing list archive at Nabble.com.
Re: How to boost exact match?
Thanks a lot for your reply. Consider the below query ?q=data managementdefType=edismaxqf=name^100 text uid^0.3fl=name I am trying to boost the name as much as possible, even then the results are in below order - doc str name=nameMANAGER/str /doc - doc str name=nameMANAGER/str /doc - doc str name=nameMANAGERS/str /doc - doc str name=name...AA DATA MANAGEMENT/str /doc - doc str name=nameBA...AA DATA MANAGEMENT/str When I turned on the debug query, I figured out that the actual keyword passed is stemmed due to usage of PorterStemFilterFactory which actually splits the keyword in to data manag and passes that to search. I am using PorterStemFilterFactory for both indexing / query. I will try to remove the porter stem from query and check if I am getting proper result. Thanks. BB Thanks, BB -- View this message in context: http://lucene.472066.n3.nabble.com/How-to-boost-exact-match-tp4015862p4015915.html Sent from the Solr - User mailing list archive at Nabble.com.
Re: How to boost exact match?
You may want to do a copyfield and have one field that is stemmed for casual matches at a lower boost while one is unstemmed and boosted higher. You could also do a copyfield to a non-tokenized field (TextField with KeywordTokenizer and lower case and trim filters) and give a match in that field a much higher boost. -- Jack Krupansky -Original Message- From: bbarani Sent: Thursday, October 25, 2012 5:34 PM To: solr-user@lucene.apache.org Subject: Re: How to boost exact match? Thanks a lot for your reply. Consider the below query ?q=data managementdefType=edismaxqf=name^100 text uid^0.3fl=name I am trying to boost the name as much as possible, even then the results are in below order - doc str name=nameMANAGER/str /doc - doc str name=nameMANAGER/str /doc - doc str name=nameMANAGERS/str /doc - doc str name=name...AA DATA MANAGEMENT/str /doc - doc str name=nameBA...AA DATA MANAGEMENT/str When I turned on the debug query, I figured out that the actual keyword passed is stemmed due to usage of PorterStemFilterFactory which actually splits the keyword in to data manag and passes that to search. I am using PorterStemFilterFactory for both indexing / query. I will try to remove the porter stem from query and check if I am getting proper result. Thanks. BB Thanks, BB -- View this message in context: http://lucene.472066.n3.nabble.com/How-to-boost-exact-match-tp4015862p4015915.html Sent from the Solr - User mailing list archive at Nabble.com.
Re: How to boost exact match?
First of all, if you stem on indexing and you don't on query time, your queries wont find anything valuable. This is an easy approach. If you want full term (no stemmed) matches were boosted you have to query like: ?q=data managementdefType=edismaxqf=*name_without_stemming^200* name^100 text uid^0.3fl=name On schema.xml you have to copy name to name_without_stemming(indexed and no stored) and don't use stemming on this field index and query analyzer definition. On Thu, Oct 25, 2012 at 11:34 PM, bbarani bbar...@gmail.com wrote: Thanks a lot for your reply. Consider the below query ?q=data managementdefType=edismaxqf=name^100 text uid^0.3fl=name I am trying to boost the name as much as possible, even then the results are in below order - doc str name=nameMANAGER/str /doc - doc str name=nameMANAGER/str /doc - doc str name=nameMANAGERS/str /doc - doc str name=name...AA DATA MANAGEMENT/str /doc - doc str name=nameBA...AA DATA MANAGEMENT/str When I turned on the debug query, I figured out that the actual keyword passed is stemmed due to usage of PorterStemFilterFactory which actually splits the keyword in to data manag and passes that to search. I am using PorterStemFilterFactory for both indexing / query. I will try to remove the porter stem from query and check if I am getting proper result. Thanks. BB Thanks, BB -- View this message in context: http://lucene.472066.n3.nabble.com/How-to-boost-exact-match-tp4015862p4015915.html Sent from the Solr - User mailing list archive at Nabble.com. -- Un saludo, Samuel García.
Re: How to boost exact match?
whops! Jack got it faster :D Sorry for double posting. On Thu, Oct 25, 2012 at 11:41 PM, Jack Krupansky j...@basetechnology.comwrote: You may want to do a copyfield and have one field that is stemmed for casual matches at a lower boost while one is unstemmed and boosted higher. You could also do a copyfield to a non-tokenized field (TextField with KeywordTokenizer and lower case and trim filters) and give a match in that field a much higher boost. -- Jack Krupansky -Original Message- From: bbarani Sent: Thursday, October 25, 2012 5:34 PM To: solr-user@lucene.apache.org Subject: Re: How to boost exact match? Thanks a lot for your reply. Consider the below query ?q=data managementdefType=edismaxqf=**name^100 text uid^0.3fl=name I am trying to boost the name as much as possible, even then the results are in below order - doc str name=nameMANAGER/str /doc - doc str name=nameMANAGER/str /doc - doc str name=nameMANAGERS/str /doc - doc str name=name...AA DATA MANAGEMENT/str /doc - doc str name=nameBA...AA DATA MANAGEMENT/str When I turned on the debug query, I figured out that the actual keyword passed is stemmed due to usage of PorterStemFilterFactory which actually splits the keyword in to data manag and passes that to search. I am using PorterStemFilterFactory for both indexing / query. I will try to remove the porter stem from query and check if I am getting proper result. Thanks. BB Thanks, BB -- View this message in context: http://lucene.472066.n3.** nabble.com/How-to-boost-exact-**match-tp4015862p4015915.htmlhttp://lucene.472066.n3.nabble.com/How-to-boost-exact-match-tp4015862p4015915.html Sent from the Solr - User mailing list archive at Nabble.com. -- Un saludo, Samuel García.
Re: how to boost exact match
@ajdabholkar, It certainly achievable. How exactly to achieve this depends on your document structure. Lets say you have iphone 4 - white iphone 4s - white iphone 4 - black case 1: You have product_name - color format If you have a field in each of your documents that specifies product_name and color delimited by -, in other words, if you know your documents have product_name - color/attribute formate, then you could do 1. copy the field to a new field, lets say ProductName ( This Field should be of type string) 2. Convert everything to lowerCaseFilterFactory then use PatternReplace filterfactory to replace everything thats after -. So you get the following. iphone 4 iphone 4s iphone 4s 3. Now boost on this new field, whenever there is a match. You bf should be something like this bq=cat:electronics^5.0 bq=cat:electronics^5.0 Do you have a product name field which says iphone 4 and attribute field which specfies the color? On Sat, Aug 11, 2012 at 1:51 AM, Li Li fancye...@gmail.com wrote: create an field for exact match. it is a optional boolean clause 在 2012-8-11 下午1:42,abhayd ajdabhol...@hotmail.com写道: hi I have documents like iphone 4 - white iphone 4s - black ipone4 - black when user searches for iphone 4 i would like to show iphone 4 docs first and iphone 4s after that. Similary when user is searching for iphone 4s i would like to show iphone 4s docs first then iphone 4 docs. At present i use whitespace tokenizer. Any idea how to achieve this? -- View this message in context: http://lucene.472066.n3.nabble.com/how-to-boost-exact-match-tp4000576.html Sent from the Solr - User mailing list archive at Nabble.com. -- -- Karthick D S Master's in Computer Engineering ( Software Track ) Syracuse University Syracuse - 13210 New York United States of America
Re: how to boost exact match
@ajdabholkar, It certainly achievable. How exactly to achieve this depends on your document structure. Lets say you have iphone 4 - white iphone 4s - white iphone 4 - black case 1: You have product_name - color format If you have a field in each of your documents that specifies product_name and color delimited by -, in other words, if you know your documents have product_name - color/attribute formate, then you could do 1. copy the field to a new field, lets say ProductName ( This Field should be of type string) 2. Convert everything to lowerCaseFilterFactory then use PatternReplace filterfactory to replace everything thats after -. So you get the following. iphone 4 iphone 4s iphone 4s 3. Now boost on this new field, whenever there is a match. You bf should be something like this bq=cat:electronics^5.0 On Sat, Aug 11, 2012 at 2:06 PM, Karthick Duraisamy Soundararaj karthick.soundara...@gmail.com wrote: @ajdabholkar, It certainly achievable. How exactly to achieve this depends on your document structure. Lets say you have iphone 4 - white iphone 4s - white iphone 4 - black case 1: You have product_name - color format If you have a field in each of your documents that specifies product_name and color delimited by -, in other words, if you know your documents have product_name - color/attribute formate, then you could do 1. copy the field to a new field, lets say ProductName ( This Field should be of type string) 2. Convert everything to lowerCaseFilterFactory then use PatternReplace filterfactory to replace everything thats after -. So you get the following. iphone 4 iphone 4s iphone 4s 3. Now boost on this new field, whenever there is a match. You bf should be something like this bq=cat:electronics^5.0 bq=cat:electronics^5.0 Do you have a product name field which says iphone 4 and attribute field which specfies the color? On Sat, Aug 11, 2012 at 1:51 AM, Li Li fancye...@gmail.com wrote: create an field for exact match. it is a optional boolean clause 在 2012-8-11 下午1:42,abhayd ajdabhol...@hotmail.com写道: hi I have documents like iphone 4 - white iphone 4s - black ipone4 - black when user searches for iphone 4 i would like to show iphone 4 docs first and iphone 4s after that. Similary when user is searching for iphone 4s i would like to show iphone 4s docs first then iphone 4 docs. At present i use whitespace tokenizer. Any idea how to achieve this? -- View this message in context: http://lucene.472066.n3.nabble.com/how-to-boost-exact-match-tp4000576.html Sent from the Solr - User mailing list archive at Nabble.com. -- -- Karthick D S Master's in Computer Engineering ( Software Track ) Syracuse University Syracuse - 13210 New York United States of America -- -- Karthick D S Master's in Computer Engineering ( Software Track ) Syracuse University Syracuse - 13210 New York United States of America
Re: how to boost exact match
Sorry about resending couple of times, I accidently hit send a couple of times.. @ajdabholkar, It certainly achievable. How exactly to achieve this depends on your document structure. Lets say you have iphone 4 - white iphone 4s - white iphone 4 - black case 1: You have product_name - color format If you have a field in each of your documents that specifies product_name and color delimited by -, in other words, if you know your documents have product_name - color/attribute formate, then you could do 1. copy the field to a new field, lets say ProductName ( This Field should be of type string) 2. Convert everything to lowerCaseFilterFactory then use PatternReplace filterfactory to replace everything thats after -. So you get the following. iphone 4 iphone 4s iphone 4s 3. Now boost on this new field, whenever there is a match. You bf should be something like this bf=product_name^5.0 case 2: You have a field that just has product_name in it If you have a field product_name, then just boost it directly by just changing its field type to string. On Sat, Aug 11, 2012 at 2:06 PM, Karthick Duraisamy Soundararaj karthick.soundara...@gmail.com wrote: @ajdabholkar, It certainly achievable. How exactly to achieve this depends on your document structure. Lets say you have iphone 4 - white iphone 4s - white iphone 4 - black case 1: You have product_name - color format If you have a field in each of your documents that specifies product_name and color delimited by -, in other words, if you know your documents have product_name - color/attribute formate, then you could do 1. copy the field to a new field, lets say ProductName ( This Field should be of type string) 2. Convert everything to lowerCaseFilterFactory then use PatternReplace filterfactory to replace everything thats after -. So you get the following. iphone 4 iphone 4s iphone 4s 3. Now boost on this new field, whenever there is a match. You bf should be something like this bq=cat:electronics^5.0 On Sat, Aug 11, 2012 at 2:06 PM, Karthick Duraisamy Soundararaj karthick.soundara...@gmail.com wrote: @ajdabholkar, It certainly achievable. How exactly to achieve this depends on your document structure. Lets say you have iphone 4 - white iphone 4s - white iphone 4 - black case 1: You have product_name - color format If you have a field in each of your documents that specifies product_name and color delimited by -, in other words, if you know your documents have product_name - color/attribute formate, then you could do 1. copy the field to a new field, lets say ProductName ( This Field should be of type string) 2. Convert everything to lowerCaseFilterFactory then use PatternReplace filterfactory to replace everything thats after -. So you get the following. iphone 4 iphone 4s iphone 4s 3. Now boost on this new field, whenever there is a match. You bf should be something like this bq=cat:electronics^5.0 bq=cat:electronics^5.0 Do you have a product name field which says iphone 4 and attribute field which specfies the color? On Sat, Aug 11, 2012 at 1:51 AM, Li Li fancye...@gmail.com wrote: create an field for exact match. it is a optional boolean clause 在 2012-8-11 下午1:42,abhayd ajdabhol...@hotmail.com写道: hi I have documents like iphone 4 - white iphone 4s - black ipone4 - black when user searches for iphone 4 i would like to show iphone 4 docs first and iphone 4s after that. Similary when user is searching for iphone 4s i would like to show iphone 4s docs first then iphone 4 docs. At present i use whitespace tokenizer. Any idea how to achieve this? -- View this message in context: http://lucene.472066.n3.nabble.com/how-to-boost-exact-match-tp4000576.html Sent from the Solr - User mailing list archive at Nabble.com.
how to boost exact match
hi I have documents like iphone 4 - white iphone 4s - black ipone4 - black when user searches for iphone 4 i would like to show iphone 4 docs first and iphone 4s after that. Similary when user is searching for iphone 4s i would like to show iphone 4s docs first then iphone 4 docs. At present i use whitespace tokenizer. Any idea how to achieve this? -- View this message in context: http://lucene.472066.n3.nabble.com/how-to-boost-exact-match-tp4000576.html Sent from the Solr - User mailing list archive at Nabble.com.
Re: how to boost exact match
create an field for exact match. it is a optional boolean clause 在 2012-8-11 下午1:42,abhayd ajdabhol...@hotmail.com写道: hi I have documents like iphone 4 - white iphone 4s - black ipone4 - black when user searches for iphone 4 i would like to show iphone 4 docs first and iphone 4s after that. Similary when user is searching for iphone 4s i would like to show iphone 4s docs first then iphone 4 docs. At present i use whitespace tokenizer. Any idea how to achieve this? -- View this message in context: http://lucene.472066.n3.nabble.com/how-to-boost-exact-match-tp4000576.html Sent from the Solr - User mailing list archive at Nabble.com.