Re: Returning documents using multi-valued field
Thanks for you answer James :) For guys who would meet up with this problem, http://markmail.org/thread/xce4qyzs5367yplo also speaks about this, and reaches James' conclusion too. On Thu, May 26, 2011 at 10:19 PM, Dyer, James james.d...@ingrambook.comwrote: This is a limitation of Lucene/Solr in that there is no way to tell it to not match across mutli-valued field occurences. A workaround is to convert your query to a phrase and add a slop factor less than your posititonIncrementGap. ex: q=alice trudy~99 ... This example assumes that your positionIncrementGap is set to 100 (the default I think) or greater. This tells it that rather than search for a strict phrase, the words in the phrase can be up to 99 positions apart. Because the multi-valued fields are implemented under-the-covers by simply increasing the position of the next occurrence by the positionIncrementGap value, this will effectively prevent Lucene/Solr from matching across occurences. The downside to this workaround is that wildcards are not permitted in phrase searches. So if you need wildcard support also, then you're out of luck. James Dyer E-Commerce Systems Ingram Content Group (615) 213-4311 -Original Message- From: Kurt Sultana [mailto:kurtanat...@gmail.com] Sent: Thursday, May 26, 2011 3:05 PM To: solr-user@lucene.apache.org Subject: Re: Returning documents using multi-valued field Hi, maybe I wasn't so clear in my previous post. Here's another go (I'd like a reply :) ): Currently I'm issuing this query on Solr: http://localhost:9001/solrfacetsearch/master_Shop/select/?q=%28keyword_text_mv%3A%28alice+AND+trudy%29%29+AND+%28catalogId%3A%22Default%22%29+AND+%28catalogVersion%3AOnline%29start=0rows=http://localhost:9001/solrfacetsearch/master_Shop/select/?q=%28keyword_text_mv%3A%28alice+AND+trudy%29%29+AND+%28catalogId%3A%22Default%22%29+AND+%28catalogVersion%3AOnline%29start=0rows=2147483647facet=truefacet.field=category_string_mvsort=preferred_boolean+desc%2Cgeo_distance+ascfacet.mincount=1facet.limit=50facet.sort=indexradius=111.84681460272012long=5.2864094qt=geolat=52.2119418debugQuery=on 2147483647 facet=truefacet.field=category_string_mvsort=preferred_boolean+desc%2Cgeo_distance+ascfacet.mincount=1facet.limit=50facet.sort=indexradius=111.84681460272012long=5.2864094qt=geolat=52.2119418debugQuery=on where as you can see I'm searching for keywords Alice AND Trudy. This query returns a document which contains: arr name=keyword_text_mv stralice jill/str strtrudy alex/str /arr The problem is I'd like the document to be returned only if it contains a string alice trudy in one of its values, in other words, if it contains : arr name=keyword_text_mv stralice trudy/str strjill alex/str /arr How could I achieve this? I'm supporting the code written by someone else and I'm quite new to Solr. Thanks in advance :) Kurt On Wed, May 25, 2011 at 11:44 AM, Kurt Sultana kurtanat...@gmail.com wrote: Hi all, I'm quite new to Solr and I'm supporting an existing Solr search engine which was written by someone else. I've been reading on Solr for the last couple of weeks so I'd consider myself beyond the basics. A particular field, let's say name, is multi-valued. For example, a document has a field name with values Alice, Trudy. We want that the document is returned when Alice or Trudy is input and not when Alice Trudy is entered. Currently the document is even with Alice Trudy. How could this be done? Thanks a lot! Kurt
Re: Returning documents using multi-valued field
Hi, maybe I wasn't so clear in my previous post. Here's another go (I'd like a reply :) ): Currently I'm issuing this query on Solr: http://localhost:9001/solrfacetsearch/master_Shop/select/?q=%28keyword_text_mv%3A%28alice+AND+trudy%29%29+AND+%28catalogId%3A%22Default%22%29+AND+%28catalogVersion%3AOnline%29start=0rows=2147483647facet=truefacet.field=category_string_mvsort=preferred_boolean+desc%2Cgeo_distance+ascfacet.mincount=1facet.limit=50facet.sort=indexradius=111.84681460272012long=5.2864094qt=geolat=52.2119418debugQuery=on where as you can see I'm searching for keywords Alice AND Trudy. This query returns a document which contains: arr name=keyword_text_mv stralice jill/str strtrudy alex/str /arr The problem is I'd like the document to be returned only if it contains a string alice trudy in one of its values, in other words, if it contains : arr name=keyword_text_mv stralice trudy/str strjill alex/str /arr How could I achieve this? I'm supporting the code written by someone else and I'm quite new to Solr. Thanks in advance :) Kurt On Wed, May 25, 2011 at 11:44 AM, Kurt Sultana kurtanat...@gmail.comwrote: Hi all, I'm quite new to Solr and I'm supporting an existing Solr search engine which was written by someone else. I've been reading on Solr for the last couple of weeks so I'd consider myself beyond the basics. A particular field, let's say name, is multi-valued. For example, a document has a field name with values Alice, Trudy. We want that the document is returned when Alice or Trudy is input and not when Alice Trudy is entered. Currently the document is even with Alice Trudy. How could this be done? Thanks a lot! Kurt
RE: Returning documents using multi-valued field
This is a limitation of Lucene/Solr in that there is no way to tell it to not match across mutli-valued field occurences. A workaround is to convert your query to a phrase and add a slop factor less than your posititonIncrementGap. ex: q=alice trudy~99 ... This example assumes that your positionIncrementGap is set to 100 (the default I think) or greater. This tells it that rather than search for a strict phrase, the words in the phrase can be up to 99 positions apart. Because the multi-valued fields are implemented under-the-covers by simply increasing the position of the next occurrence by the positionIncrementGap value, this will effectively prevent Lucene/Solr from matching across occurences. The downside to this workaround is that wildcards are not permitted in phrase searches. So if you need wildcard support also, then you're out of luck. James Dyer E-Commerce Systems Ingram Content Group (615) 213-4311 -Original Message- From: Kurt Sultana [mailto:kurtanat...@gmail.com] Sent: Thursday, May 26, 2011 3:05 PM To: solr-user@lucene.apache.org Subject: Re: Returning documents using multi-valued field Hi, maybe I wasn't so clear in my previous post. Here's another go (I'd like a reply :) ): Currently I'm issuing this query on Solr: http://localhost:9001/solrfacetsearch/master_Shop/select/?q=%28keyword_text_mv%3A%28alice+AND+trudy%29%29+AND+%28catalogId%3A%22Default%22%29+AND+%28catalogVersion%3AOnline%29start=0rows=2147483647facet=truefacet.field=category_string_mvsort=preferred_boolean+desc%2Cgeo_distance+ascfacet.mincount=1facet.limit=50facet.sort=indexradius=111.84681460272012long=5.2864094qt=geolat=52.2119418debugQuery=on where as you can see I'm searching for keywords Alice AND Trudy. This query returns a document which contains: arr name=keyword_text_mv stralice jill/str strtrudy alex/str /arr The problem is I'd like the document to be returned only if it contains a string alice trudy in one of its values, in other words, if it contains : arr name=keyword_text_mv stralice trudy/str strjill alex/str /arr How could I achieve this? I'm supporting the code written by someone else and I'm quite new to Solr. Thanks in advance :) Kurt On Wed, May 25, 2011 at 11:44 AM, Kurt Sultana kurtanat...@gmail.comwrote: Hi all, I'm quite new to Solr and I'm supporting an existing Solr search engine which was written by someone else. I've been reading on Solr for the last couple of weeks so I'd consider myself beyond the basics. A particular field, let's say name, is multi-valued. For example, a document has a field name with values Alice, Trudy. We want that the document is returned when Alice or Trudy is input and not when Alice Trudy is entered. Currently the document is even with Alice Trudy. How could this be done? Thanks a lot! Kurt
Returning documents using multi-valued field
Hi all, I'm quite new to Solr and I'm supporting an existing Solr search engine which was written by someone else. I've been reading on Solr for the last couple of weeks so I'd consider myself beyond the basics. A particular field, let's say name, is multi-valued. For example, a document has a field name with values Alice, Trudy. We want that the document is returned when Alice or Trudy is input and not when Alice Trudy is entered. Currently the document is even with Alice Trudy. How could this be done? Thanks a lot! Kurt