Re: Multipath hierarchical faceting
Not quite sure if this suits your needs, but what about: PathHierarchyTokenizerFactory? On Fri, Nov 17, 2017 at 5:24 AM, Emir Arnautović <emir.arnauto...@sematext.com> wrote: > Hi, > In order to use this feature, you would have to patch Solr and build it > yourself. But note that this ticket is old and the last patch version is from > 2014, so you would either have to patch referenced version of adjust patch to > work with version that you are targeting. > > HTH, > Emir > -- > Monitoring - Log Management - Alerting - Anomaly Detection > Solr & Elasticsearch Consulting Support Training - http://sematext.com/ > > > >> On 17 Nov 2017, at 11:28, 喜阳阳 <389610...@qq.com> wrote: >> >> Hi >> I am a newbie and I do not unserstand SOLR-2412 I am trying Solr and i have >> one question.I want to use Multipath hierarchical faceting but i do not konw >> how to do it .Because i want to use it with Solr API. >> Is there any class in newest Solr api to specify the HierarchicalFacetField >> like org.apache.solr.schema.HierarchicalFacetField in Solr 3.10?Looking >> forward to your reply.Thank you very much. >
Re: Multipath hierarchical faceting
Hi, In order to use this feature, you would have to patch Solr and build it yourself. But note that this ticket is old and the last patch version is from 2014, so you would either have to patch referenced version of adjust patch to work with version that you are targeting. HTH, Emir -- Monitoring - Log Management - Alerting - Anomaly Detection Solr & Elasticsearch Consulting Support Training - http://sematext.com/ > On 17 Nov 2017, at 11:28, 喜阳阳 <389610...@qq.com> wrote: > > Hi > I am a newbie and I do not unserstand SOLR-2412 I am trying Solr and i have > one question.I want to use Multipath hierarchical faceting but i do not konw > how to do it .Because i want to use it with Solr API. > Is there any class in newest Solr api to specify the HierarchicalFacetField > like org.apache.solr.schema.HierarchicalFacetField in Solr 3.10?Looking > forward to your reply.Thank you very much.
Multipath hierarchical faceting
Hi I am a newbie and I do not unserstand SOLR-2412 I am trying Solr and i have one question.I want to use Multipath hierarchical faceting but i do not konw how to do it .Because i want to use it with Solr API. Is there any class in newest Solr api to specify the HierarchicalFacetField like org.apache.solr.schema.HierarchicalFacetField in Solr 3.10?Looking forward to your reply.Thank you very much.
RE: Hierarchical faceting
Thanks Evan and Jason. I'll probably go with the approach that Evan suggested. This allows the UI to change and display full hierarchy if required in future. -Original Message- From: Evan Pease [mailto:evancpe...@gmail.com] Sent: Tuesday, November 18, 2014 12:41 AM To: solr-user@lucene.apache.org Subject: Re: Hierarchical faceting I'm looking to see if Solr has any in-built tokenizer that splits the tokens and prepends with the depth information. I'd like to avoid building depth information into the filed values if Solr already has something that can be used. So the goal is to find out the level of the tree for each category? You could determine this in the UI by splitting the category facet value string by the separator. As you're aware, when you query a field indexed using solr.PathHierarchyTokenizerFactory you still get the full path category path back as a facet value. For example, if a user navigates to Phy: fq={!term f=category}NonFic/Sci/Phy The facet values that are returned will look like this (made up counts): lst name=category int name=NonFic/Sci/Phy10/int int name=NonFic/Sci/Phy/Quantum10/int /lst You could find out the level by doing .split(/).length on each value. ECP On Mon, Nov 17, 2014 at 9:25 PM, Jason Hellman jhellman.innov...@gmail.com wrote: I realize you want to avoid putting depth details into the field values, but something has to imply the depth. So with that in mind, here is another approach (with the assumption that you are chasing down a single branch of a tree (and all its subbranch offshoots)), Use dynamic fields Step from one level to the next with a simple increment Build the facet for the next level on the call The UI needs only know the current level This would possibly be as so: step_fieldname_n With a dynamic field configuration of: step_* The content of the step_fieldname_n field would either be the strong of the field value or the delimited path of the current level (as suited to taste). Either way, most likely a fieldType of String (or some variation thereof) The UI would then call: facet.field=step_fieldname_n+1 And the UI would need to be aware to carry the n+1 into the fq link verbiage: fq=step_fieldname_n+1:facetvalue The trick of all of this is that you must build your index with the depth of your hierarchy in mind to place the values into the suitable fields. You could, of course, write an UpdateProcessor to accomplish this if that seems fitting. Jason On Nov 17, 2014, at 12:22 PM, Alexandre Rafalovitch arafa...@gmail.com wrote: You might be able to stick in a couple of PatternReplaceFilterFactory in a row with regular expressions to catch different levels. Something like: filter class=solr.PatternReplaceFilterFactory pattern=^[^0-9][^/]+/[^/]/[^/]+$ replacement=2$0 / filter class=solr.PatternReplaceFilterFactory pattern=^[^0-9][^/]+/[^/]$ replacement=1$0 / ... I did not test this, you may need to escape some thing or put explicit groups in there. Regards, Alex. P.s. http://www.solr-start.com/javadoc/solr-lucene/org/apache/lucene/analys is/pattern/PatternReplaceFilterFactory.html Personal: http://www.outerthoughts.com/ and @arafalov Solr resources and newsletter: http://www.solr-start.com/ and @solrstart Solr popularizers community: https://www.linkedin.com/groups?gid=6713853 On 17 November 2014 15:01, rashmy1 rashmy.appanerava...@siemens.com wrote: Hi Alexandre, Yes, I've read this post and that's the 'Option1' listed in my initial post. I'm looking to see if Solr has any in-built tokenizer that splits the tokens and prepends with the depth information. I'd like to avoid building depth information into the filed values if Solr already has something that can be used. Thanks! -- View this message in context: http://lucene.472066.n3.nabble.com/Hierarchical-faceting-tp4169263p416 9536.html Sent from the Solr - User mailing list archive at Nabble.com.
Re: Hierarchical faceting
Hi Alexandre, Yes, I've read this post and that's the 'Option1' listed in my initial post. I'm looking to see if Solr has any in-built tokenizer that splits the tokens and prepends with the depth information. I'd like to avoid building depth information into the filed values if Solr already has something that can be used. Thanks! -- View this message in context: http://lucene.472066.n3.nabble.com/Hierarchical-faceting-tp4169263p4169536.html Sent from the Solr - User mailing list archive at Nabble.com.
Re: Hierarchical faceting
You might be able to stick in a couple of PatternReplaceFilterFactory in a row with regular expressions to catch different levels. Something like: filter class=solr.PatternReplaceFilterFactory pattern=^[^0-9][^/]+/[^/]/[^/]+$ replacement=2$0 / filter class=solr.PatternReplaceFilterFactory pattern=^[^0-9][^/]+/[^/]$ replacement=1$0 / ... I did not test this, you may need to escape some thing or put explicit groups in there. Regards, Alex. P.s. http://www.solr-start.com/javadoc/solr-lucene/org/apache/lucene/analysis/pattern/PatternReplaceFilterFactory.html Personal: http://www.outerthoughts.com/ and @arafalov Solr resources and newsletter: http://www.solr-start.com/ and @solrstart Solr popularizers community: https://www.linkedin.com/groups?gid=6713853 On 17 November 2014 15:01, rashmy1 rashmy.appanerava...@siemens.com wrote: Hi Alexandre, Yes, I've read this post and that's the 'Option1' listed in my initial post. I'm looking to see if Solr has any in-built tokenizer that splits the tokens and prepends with the depth information. I'd like to avoid building depth information into the filed values if Solr already has something that can be used. Thanks! -- View this message in context: http://lucene.472066.n3.nabble.com/Hierarchical-faceting-tp4169263p4169536.html Sent from the Solr - User mailing list archive at Nabble.com.
Re: Hierarchical faceting
I realize you want to avoid putting depth details into the field values, but something has to imply the depth. So with that in mind, here is another approach (with the assumption that you are chasing down a single branch of a tree (and all its subbranch offshoots)), Use dynamic fields Step from one level to the next with a simple increment Build the facet for the next level on the call The UI needs only know the current level This would possibly be as so: step_fieldname_n With a dynamic field configuration of: step_* The content of the step_fieldname_n field would either be the strong of the field value or the delimited path of the current level (as suited to taste). Either way, most likely a fieldType of String (or some variation thereof) The UI would then call: facet.field=step_fieldname_n+1 And the UI would need to be aware to carry the n+1 into the fq link verbiage: fq=step_fieldname_n+1:facetvalue The trick of all of this is that you must build your index with the depth of your hierarchy in mind to place the values into the suitable fields. You could, of course, write an UpdateProcessor to accomplish this if that seems fitting. Jason On Nov 17, 2014, at 12:22 PM, Alexandre Rafalovitch arafa...@gmail.com wrote: You might be able to stick in a couple of PatternReplaceFilterFactory in a row with regular expressions to catch different levels. Something like: filter class=solr.PatternReplaceFilterFactory pattern=^[^0-9][^/]+/[^/]/[^/]+$ replacement=2$0 / filter class=solr.PatternReplaceFilterFactory pattern=^[^0-9][^/]+/[^/]$ replacement=1$0 / ... I did not test this, you may need to escape some thing or put explicit groups in there. Regards, Alex. P.s. http://www.solr-start.com/javadoc/solr-lucene/org/apache/lucene/analysis/pattern/PatternReplaceFilterFactory.html Personal: http://www.outerthoughts.com/ and @arafalov Solr resources and newsletter: http://www.solr-start.com/ and @solrstart Solr popularizers community: https://www.linkedin.com/groups?gid=6713853 On 17 November 2014 15:01, rashmy1 rashmy.appanerava...@siemens.com wrote: Hi Alexandre, Yes, I've read this post and that's the 'Option1' listed in my initial post. I'm looking to see if Solr has any in-built tokenizer that splits the tokens and prepends with the depth information. I'd like to avoid building depth information into the filed values if Solr already has something that can be used. Thanks! -- View this message in context: http://lucene.472066.n3.nabble.com/Hierarchical-faceting-tp4169263p4169536.html Sent from the Solr - User mailing list archive at Nabble.com.
Re: Hierarchical faceting
I'm looking to see if Solr has any in-built tokenizer that splits the tokens and prepends with the depth information. I'd like to avoid building depth information into the filed values if Solr already has something that can be used. So the goal is to find out the level of the tree for each category? You could determine this in the UI by splitting the category facet value string by the separator. As you're aware, when you query a field indexed using solr.PathHierarchyTokenizerFactory you still get the full path category path back as a facet value. For example, if a user navigates to Phy: fq={!term f=category}NonFic/Sci/Phy The facet values that are returned will look like this (made up counts): lst name=category int name=NonFic/Sci/Phy10/int int name=NonFic/Sci/Phy/Quantum10/int /lst You could find out the level by doing .split(/).length on each value. ECP On Mon, Nov 17, 2014 at 9:25 PM, Jason Hellman jhellman.innov...@gmail.com wrote: I realize you want to avoid putting depth details into the field values, but something has to imply the depth. So with that in mind, here is another approach (with the assumption that you are chasing down a single branch of a tree (and all its subbranch offshoots)), Use dynamic fields Step from one level to the next with a simple increment Build the facet for the next level on the call The UI needs only know the current level This would possibly be as so: step_fieldname_n With a dynamic field configuration of: step_* The content of the step_fieldname_n field would either be the strong of the field value or the delimited path of the current level (as suited to taste). Either way, most likely a fieldType of String (or some variation thereof) The UI would then call: facet.field=step_fieldname_n+1 And the UI would need to be aware to carry the n+1 into the fq link verbiage: fq=step_fieldname_n+1:facetvalue The trick of all of this is that you must build your index with the depth of your hierarchy in mind to place the values into the suitable fields. You could, of course, write an UpdateProcessor to accomplish this if that seems fitting. Jason On Nov 17, 2014, at 12:22 PM, Alexandre Rafalovitch arafa...@gmail.com wrote: You might be able to stick in a couple of PatternReplaceFilterFactory in a row with regular expressions to catch different levels. Something like: filter class=solr.PatternReplaceFilterFactory pattern=^[^0-9][^/]+/[^/]/[^/]+$ replacement=2$0 / filter class=solr.PatternReplaceFilterFactory pattern=^[^0-9][^/]+/[^/]$ replacement=1$0 / ... I did not test this, you may need to escape some thing or put explicit groups in there. Regards, Alex. P.s. http://www.solr-start.com/javadoc/solr-lucene/org/apache/lucene/analysis/pattern/PatternReplaceFilterFactory.html Personal: http://www.outerthoughts.com/ and @arafalov Solr resources and newsletter: http://www.solr-start.com/ and @solrstart Solr popularizers community: https://www.linkedin.com/groups?gid=6713853 On 17 November 2014 15:01, rashmy1 rashmy.appanerava...@siemens.com wrote: Hi Alexandre, Yes, I've read this post and that's the 'Option1' listed in my initial post. I'm looking to see if Solr has any in-built tokenizer that splits the tokens and prepends with the depth information. I'd like to avoid building depth information into the filed values if Solr already has something that can be used. Thanks! -- View this message in context: http://lucene.472066.n3.nabble.com/Hierarchical-faceting-tp4169263p4169536.html Sent from the Solr - User mailing list archive at Nabble.com.
Re: Hierarchical faceting
Thank you Evan and Oleg. This is exactly what I had implemented (Option 2). My issue is Evan Pease wrote Then, in your Solr query, you can simply add: facet=true facet.field=category You should see a facet that contains each level of the taxonomy with counts. As you mentioned, we get each level of the taxonomy while I'd like to do drill down query. For example, if the Solr query was: facet=true facet.field=category My intention is to get just the first level as results: NonFic (8) Fic (3) Then if user clicks on 'NonFic' in UI, we want to fetch only the next immediate level: NonFic Hist (2) Sci (6) Then if user clicks on 'Sci' in UI, we want to fetch only the next immediate level: NonFic Sci Phy(4) Chem(1) Math(1) Myabe I can still use PathHierarchyTokenizer, but could you let me know how to form my facet query to fetch the results one level at a time. Thanks! -- View this message in context: http://lucene.472066.n3.nabble.com/Hierarchical-faceting-tp4169263p4169413.html Sent from the Solr - User mailing list archive at Nabble.com.
Re: Hierarchical faceting
Would this approach be an answer? https://lucidworks.com/blog/easy-hierarchical-faceting-and-display-with-solr-and-jquery-and-a-tiny-bit-of-python/ Regards, Alex. Personal: http://www.outerthoughts.com/ and @arafalov Solr resources and newsletter: http://www.solr-start.com/ and @solrstart Solr popularizers community: https://www.linkedin.com/groups?gid=6713853 On 16 November 2014 20:36, rashmy1 rashmy.appanerava...@siemens.com wrote: Thank you Evan and Oleg. This is exactly what I had implemented (Option 2). My issue is Evan Pease wrote Then, in your Solr query, you can simply add: facet=true facet.field=category You should see a facet that contains each level of the taxonomy with counts. As you mentioned, we get each level of the taxonomy while I'd like to do drill down query. For example, if the Solr query was: facet=true facet.field=category My intention is to get just the first level as results: NonFic (8) Fic (3) Then if user clicks on 'NonFic' in UI, we want to fetch only the next immediate level: NonFic Hist (2) Sci (6) Then if user clicks on 'Sci' in UI, we want to fetch only the next immediate level: NonFic Sci Phy(4) Chem(1) Math(1) Myabe I can still use PathHierarchyTokenizer, but could you let me know how to form my facet query to fetch the results one level at a time. Thanks! -- View this message in context: http://lucene.472066.n3.nabble.com/Hierarchical-faceting-tp4169263p4169413.html Sent from the Solr - User mailing list archive at Nabble.com.
Hierarchical faceting
Hello, I'm trying to setup Solr for fetching hierarchical facets. Please advice which of the below approaches should be followed for my scenario. *Scenario: * NonFic Hist HistBook1 HistBook2 Sci Phy Quantum Pbook1 Pbook2 Thermodynamics Pbook3 Pbook4 Chem Cbook1 Math Mbook1 Fic Mystery Mybook1 Childrens Chbook1 Chbook2 *Sample document* doc name=Pbook1 category=NonFic/Sci/Phy/Quantum author=ABC price=20.00 doc *Requirements:* -Show drill down facets -If user searched for *, the initial set of facets to be shown are 'NonFic' and 'Fic' -If user selects facet 'NonFic', we then show the facets 'Hist' and 'Sci' only. *Option1:* /Solr schema:/ field indexed=true multiValued=true name=category required=true stored=true type=string/ /Document supplied for indexing:/ doc name=Pbook1 category=0/NonFic category=1/NonFic/Sci category=2/NonFic/Sci/Phy category=3/NonFic/Sci/Phy/Quantum category=0/Other (a book can belong to multiple categories) author=ABC price=20.00 doc With Option2, we can do a drill down facet query. For example, if we give facet.prefix=NonFic/Sci/, the facet results are: NonFic/Sci/Phy NonFic/Sci/Chem NonFic/Sci/Math The only issue is that I have to take care of generating all possible path information for 'category' *Option2:* /Solr schema:/ fieldType class=solr.TextField name=path analyzer type=index tokenizer class=solr.PathHierarchyTokenizerFactory delimiter=// /analyzer /fieldType field indexed=true multiValued=true name=category required=true stored=true type=path/ /Document supplied for indexing:/ doc name=Pbook1 category=NonFic/Sci/Phy/Quantum author=ABC price=20.00 doc With Option2, we can do facet query but it returns all possible combination of paths. For example, if we give facet.prefix=Fic, the facet results are: Fic (3) Fic/Mystery (1) Fic/Childrens (2) I'm looking to supply a doc with just a single entry (like 'category=NonFic/Sci/Phy/Quantum' ) and be able to do a drill down query. Is there some existing Solr tokernizer which takes care of generating all possibly combinations which indexing instead of having to generating them as part of doc creation? Thanks -- View this message in context: http://lucene.472066.n3.nabble.com/Hierarchical-faceting-tp4169263.html Sent from the Solr - User mailing list archive at Nabble.com.
Re: Hierarchical faceting
Hi Rashmi, I believe you are looking for PathHierarchyTokenizer, see https://lucene.apache.org/core/4_0_0/analyzers-common/org/apache/lucene/analysis/path/PathHierarchyTokenizer.html Oleg 2014-11-14 17:53 GMT-05:00 rashmy1 rashmy.appanerava...@siemens.com: Hello, I'm trying to setup Solr for fetching hierarchical facets. Please advice which of the below approaches should be followed for my scenario. *Scenario: * NonFic Hist HistBook1 HistBook2 Sci Phy Quantum Pbook1 Pbook2 Thermodynamics Pbook3 Pbook4 Chem Cbook1 Math Mbook1 Fic Mystery Mybook1 Childrens Chbook1 Chbook2 *Sample document* doc name=Pbook1 category=NonFic/Sci/Phy/Quantum author=ABC price=20.00 doc *Requirements:* -Show drill down facets -If user searched for *, the initial set of facets to be shown are 'NonFic' and 'Fic' -If user selects facet 'NonFic', we then show the facets 'Hist' and 'Sci' only. *Option1:* /Solr schema:/ field indexed=true multiValued=true name=category required=true stored=true type=string/ /Document supplied for indexing:/ doc name=Pbook1 category=0/NonFic category=1/NonFic/Sci category=2/NonFic/Sci/Phy category=3/NonFic/Sci/Phy/Quantum category=0/Other (a book can belong to multiple categories) author=ABC price=20.00 doc With Option2, we can do a drill down facet query. For example, if we give facet.prefix=NonFic/Sci/, the facet results are: NonFic/Sci/Phy NonFic/Sci/Chem NonFic/Sci/Math The only issue is that I have to take care of generating all possible path information for 'category' *Option2:* /Solr schema:/ fieldType class=solr.TextField name=path analyzer type=index tokenizer class=solr.PathHierarchyTokenizerFactory delimiter=// /analyzer /fieldType field indexed=true multiValued=true name=category required=true stored=true type=path/ /Document supplied for indexing:/ doc name=Pbook1 category=NonFic/Sci/Phy/Quantum author=ABC price=20.00 doc With Option2, we can do facet query but it returns all possible combination of paths. For example, if we give facet.prefix=Fic, the facet results are: Fic (3) Fic/Mystery (1) Fic/Childrens (2) I'm looking to supply a doc with just a single entry (like 'category=NonFic/Sci/Phy/Quantum' ) and be able to do a drill down query. Is there some existing Solr tokernizer which takes care of generating all possibly combinations which indexing instead of having to generating them as part of doc creation? Thanks -- View this message in context: http://lucene.472066.n3.nabble.com/Hierarchical-faceting-tp4169263.html Sent from the Solr - User mailing list archive at Nabble.com.
Re: Hierarchical faceting
Hi Rashmi, Here is some more details on how to use PathHierarchyTokenizer that Oleg provided the link to. If this is your document: *Sample document* doc name=Pbook1 category=NonFic/Sci/Phy/Quantum author=ABC price=20.00 doc Then, in your schema.xml: field name=category type=tree indexed=true stored=true multiValued=true/ fieldType name=tree class=solr.TextField analyzer type=index tokenizer class=solr.PathHierarchyTokenizerFactory delimiter=/ / /analyzer analyzer type=query tokenizer class=solr.KeywordTokenizerFactory / /analyzer /fieldType Then, in your Solr query, you can simply add: facet=true facet.field=category You should see a facet that contains each level of the taxonomy with counts. To navigate the taxonomy you add filter queries using the part of the path you want narrow the results down to (values from the category facet). So, for example a user clicks on NonFic facet=true facet.field=category fq={!term f=category}NonFic Then NonFic/Sci fq={!term f=category}NonFic/Sci Then NonFic/Sci/Phy fq={!term f=category}NonFic/Sci/Phy etc.. If you only want to display the leaf level category and indent child categories you can easily do this in your UI by splitting the facet value on your separator, / in this case. Thanks, Evan On Nov 14, 2014 8:06 PM, Oleg Savrasov osavra...@griddynamics.com wrote: Hi Rashmi, I believe you are looking for PathHierarchyTokenizer, see https://lucene.apache.org/core/4_0_0/analyzers-common/org/apache/lucene/analysis/path/PathHierarchyTokenizer.html Oleg 2014-11-14 17:53 GMT-05:00 rashmy1 rashmy.appanerava...@siemens.com: Hello, I'm trying to setup Solr for fetching hierarchical facets. Please advice which of the below approaches should be followed for my scenario. *Scenario: * NonFic Hist HistBook1 HistBook2 Sci Phy Quantum Pbook1 Pbook2 Thermodynamics Pbook3 Pbook4 Chem Cbook1 Math Mbook1 Fic Mystery Mybook1 Childrens Chbook1 Chbook2 *Sample document* doc name=Pbook1 category=NonFic/Sci/Phy/Quantum author=ABC price=20.00 doc *Requirements:* -Show drill down facets -If user searched for *, the initial set of facets to be shown are 'NonFic' and 'Fic' -If user selects facet 'NonFic', we then show the facets 'Hist' and 'Sci' only. *Option1:* /Solr schema:/ field indexed=true multiValued=true name=category required=true stored=true type=string/ /Document supplied for indexing:/ doc name=Pbook1 category=0/NonFic category=1/NonFic/Sci category=2/NonFic/Sci/Phy category=3/NonFic/Sci/Phy/Quantum category=0/Other (a book can belong to multiple categories) author=ABC price=20.00 doc With Option2, we can do a drill down facet query. For example, if we give facet.prefix=NonFic/Sci/, the facet results are: NonFic/Sci/Phy NonFic/Sci/Chem NonFic/Sci/Math The only issue is that I have to take care of generating all possible path information for 'category' *Option2:* /Solr schema:/ fieldType class=solr.TextField name=path analyzer type=index tokenizer class=solr.PathHierarchyTokenizerFactory delimiter=// /analyzer /fieldType field indexed=true multiValued=true name=category required=true stored=true type=path/ /Document supplied for indexing:/ doc name=Pbook1 category=NonFic/Sci/Phy/Quantum author=ABC price=20.00 doc With Option2, we can do facet query but it returns all possible combination of paths. For example, if we give facet.prefix=Fic, the facet results are: Fic (3) Fic/Mystery (1) Fic/Childrens (2) I'm looking to supply a doc with just a single entry (like 'category=NonFic/Sci/Phy/Quantum' ) and be able to do a drill down query. Is there some existing Solr tokernizer which takes care of generating all possibly combinations which indexing instead of having to generating them as part of doc creation? Thanks -- View this message in context: http://lucene.472066.n3.nabble.com/Hierarchical-faceting-tp4169263.html Sent from the Solr - User mailing list archive at Nabble.com.
Re: Hierarchical Faceting
Hi, Thanks Upayavira . But still i am not getting results well. I have been followinghttp://wiki.apache.org/solr/HierarchicalFaceting I have hierarchical data for facet . Some documents also have multiple hierarchy. like : Doc#1 London UK 51.5 Doc#2 UK 54.0 Doc#3 Indiana United States 40.0, London UK51.5 Doc#4 United States 39.7, Washington United States 38.8 what can be optimal schema for indexing this data so that i get following result by solr query : 1) i want to retrieve hierarchical data count by facet pivot query . ex: facet.pivot=country,state 2) I want Lat values wrt every document in query output.ex: Doc#3 40.0,51.5 . Doc#2 54.0 3) I get direct search query like country:United states . state :Washington I think through this i am able to express my requirement along with data . Please tell me how can i put data index and retreive through query . I check out solution which you provided me about PathHierarchyTokenizerFactory. But along with hierarachy i have to put data with name State,district,lat,lon etc. So that i can also access direct query on fields. Thanks Varsha On 05/15/2013 10:32 PM, Upayavira wrote: Can't you use the PathHierarchyTokenizerFactory mentioned on that page? I think it is called descendent-path in the default schema. Won't that get you what you want? UK/London/Covent Garden becomes UK UK/London UK/London/Covent Garden and India/Maharastra/Pune/Dapodi becomes India India/Maharastra India/Maharastra/Pune India/Maharastra/Pune/Dapodi These fields can be multivalued. Upayavira On Wed, May 15, 2013, at 12:29 PM, varsha.yadav wrote: Hi I go through that but i want to index multiple location in single document and a single location have multiple feature/attribute like country,state,district etc. I want Index and want hierarchical facet result on facet pivot query. One more thing , my document varies may have single ,two ,three.. any number of location. On 05/15/2013 03:55 PM, Upayavira wrote: http://wiki.apache.org/solr/HierarchicalFaceting On Wed, May 15, 2013, at 09:44 AM, varsha.yadav wrote: Hi Everyone, I am working on Hierarchical Faceting. I am indexing location of document with their state and district. I would like to find counts of every country with state count and district count. I found facet pivot working well to give me count if i use single valued fields like --- doc str name=countryindia/str str name=statemaharashtra/str /doc doc str name=countryindia/str str name=stategujrat/str /doc doc str name=countryindia/str str name=districtFaridabad/str str name=stateHaryana/str /doc doc str name=countrychina/str str name=districtfoshan/str str name=stateguangdong/str /doc I found results that is fine : arr name=country,state,district,event lst str name=fieldcountry/str str name=valueindia/str int name=count1/int arr name=pivot lst str name=fieldstate/str str name=valuemaharashtra/str int name=count1/int arr name=pivot/arr lst str name=fieldstate/str str name=valueHaryana/str int name=count1/int arr name=pivot lst str name=fielddistrict/str str name=valueFaridabad/str int name=count1/int /lst /arr /lst /arr /lst /arr /lst lst str name=fieldcountry/str str name=valuechina/str int name=count1/int arr name=pivot lst str name=fieldstate/str /lst /arr But if my document have multiple location like : doc arr name=location strjapan|JAPAN|null|/str str brisbane|Australia|Queensland /str str afghanistan|AFGHANISTAN|null /str /arr /doc doc arr name=location str afghanistan|AFGHANISTAN|null /str /arr /doc doc arr name=location str brisbane|Australia|Queensland /str /str /arr /doc Can anyone tell , me how should i put data in solr index to get hierarical data. Thanks Varsha -- Thanks Regards Varsha -- Thanks Regards Varsha
Hierarchical Faceting
Hi Everyone, I am working on Hierarchical Faceting. I am indexing location of document with their state and district. I would like to find counts of every country with state count and district count. I found facet pivot working well to give me count if i use single valued fields like --- doc str name=countryindia/str str name=statemaharashtra/str /doc doc str name=countryindia/str str name=stategujrat/str /doc doc str name=countryindia/str str name=districtFaridabad/str str name=stateHaryana/str /doc doc str name=countrychina/str str name=districtfoshan/str str name=stateguangdong/str /doc I found results that is fine : arr name=country,state,district,event lst str name=fieldcountry/str str name=valueindia/str int name=count1/int arr name=pivot lst str name=fieldstate/str str name=valuemaharashtra/str int name=count1/int arr name=pivot/arr lst str name=fieldstate/str str name=valueHaryana/str int name=count1/int arr name=pivot lst str name=fielddistrict/str str name=valueFaridabad/str int name=count1/int /lst /arr /lst /arr /lst /arr /lst lst str name=fieldcountry/str str name=valuechina/str int name=count1/int arr name=pivot lst str name=fieldstate/str /lst /arr But if my document have multiple location like : doc arr name=location strjapan|JAPAN|null|/str str brisbane|Australia|Queensland /str str afghanistan|AFGHANISTAN|null /str /arr /doc doc arr name=location str afghanistan|AFGHANISTAN|null /str /arr /doc doc arr name=location str brisbane|Australia|Queensland /str /str /arr /doc Can anyone tell , me how should i put data in solr index to get hierarical data. Thanks Varsha
Re: Hierarchical Faceting
http://wiki.apache.org/solr/HierarchicalFaceting On Wed, May 15, 2013, at 09:44 AM, varsha.yadav wrote: Hi Everyone, I am working on Hierarchical Faceting. I am indexing location of document with their state and district. I would like to find counts of every country with state count and district count. I found facet pivot working well to give me count if i use single valued fields like --- doc str name=countryindia/str str name=statemaharashtra/str /doc doc str name=countryindia/str str name=stategujrat/str /doc doc str name=countryindia/str str name=districtFaridabad/str str name=stateHaryana/str /doc doc str name=countrychina/str str name=districtfoshan/str str name=stateguangdong/str /doc I found results that is fine : arr name=country,state,district,event lst str name=fieldcountry/str str name=valueindia/str int name=count1/int arr name=pivot lst str name=fieldstate/str str name=valuemaharashtra/str int name=count1/int arr name=pivot/arr lst str name=fieldstate/str str name=valueHaryana/str int name=count1/int arr name=pivot lst str name=fielddistrict/str str name=valueFaridabad/str int name=count1/int /lst /arr /lst /arr /lst /arr /lst lst str name=fieldcountry/str str name=valuechina/str int name=count1/int arr name=pivot lst str name=fieldstate/str /lst /arr But if my document have multiple location like : doc arr name=location strjapan|JAPAN|null|/str str brisbane|Australia|Queensland /str str afghanistan|AFGHANISTAN|null /str /arr /doc doc arr name=location str afghanistan|AFGHANISTAN|null /str /arr /doc doc arr name=location str brisbane|Australia|Queensland /str /str /arr /doc Can anyone tell , me how should i put data in solr index to get hierarical data. Thanks Varsha
Re: Hierarchical Faceting
Hi I go through that but i want to index multiple location in single document and a single location have multiple feature/attribute like country,state,district etc. I want Index and want hierarchical facet result on facet pivot query. One more thing , my document varies may have single ,two ,three.. any number of location. On 05/15/2013 03:55 PM, Upayavira wrote: http://wiki.apache.org/solr/HierarchicalFaceting On Wed, May 15, 2013, at 09:44 AM, varsha.yadav wrote: Hi Everyone, I am working on Hierarchical Faceting. I am indexing location of document with their state and district. I would like to find counts of every country with state count and district count. I found facet pivot working well to give me count if i use single valued fields like --- doc str name=countryindia/str str name=statemaharashtra/str /doc doc str name=countryindia/str str name=stategujrat/str /doc doc str name=countryindia/str str name=districtFaridabad/str str name=stateHaryana/str /doc doc str name=countrychina/str str name=districtfoshan/str str name=stateguangdong/str /doc I found results that is fine : arr name=country,state,district,event lst str name=fieldcountry/str str name=valueindia/str int name=count1/int arr name=pivot lst str name=fieldstate/str str name=valuemaharashtra/str int name=count1/int arr name=pivot/arr lst str name=fieldstate/str str name=valueHaryana/str int name=count1/int arr name=pivot lst str name=fielddistrict/str str name=valueFaridabad/str int name=count1/int /lst /arr /lst /arr /lst /arr /lst lst str name=fieldcountry/str str name=valuechina/str int name=count1/int arr name=pivot lst str name=fieldstate/str /lst /arr But if my document have multiple location like : doc arr name=location strjapan|JAPAN|null|/str str brisbane|Australia|Queensland /str str afghanistan|AFGHANISTAN|null /str /arr /doc doc arr name=location str afghanistan|AFGHANISTAN|null /str /arr /doc doc arr name=location str brisbane|Australia|Queensland /str /str /arr /doc Can anyone tell , me how should i put data in solr index to get hierarical data. Thanks Varsha -- Thanks Regards Varsha
Re: Hierarchical Faceting
Can't you use the PathHierarchyTokenizerFactory mentioned on that page? I think it is called descendent-path in the default schema. Won't that get you what you want? UK/London/Covent Garden becomes UK UK/London UK/London/Covent Garden and India/Maharastra/Pune/Dapodi becomes India India/Maharastra India/Maharastra/Pune India/Maharastra/Pune/Dapodi These fields can be multivalued. Upayavira On Wed, May 15, 2013, at 12:29 PM, varsha.yadav wrote: Hi I go through that but i want to index multiple location in single document and a single location have multiple feature/attribute like country,state,district etc. I want Index and want hierarchical facet result on facet pivot query. One more thing , my document varies may have single ,two ,three.. any number of location. On 05/15/2013 03:55 PM, Upayavira wrote: http://wiki.apache.org/solr/HierarchicalFaceting On Wed, May 15, 2013, at 09:44 AM, varsha.yadav wrote: Hi Everyone, I am working on Hierarchical Faceting. I am indexing location of document with their state and district. I would like to find counts of every country with state count and district count. I found facet pivot working well to give me count if i use single valued fields like --- doc str name=countryindia/str str name=statemaharashtra/str /doc doc str name=countryindia/str str name=stategujrat/str /doc doc str name=countryindia/str str name=districtFaridabad/str str name=stateHaryana/str /doc doc str name=countrychina/str str name=districtfoshan/str str name=stateguangdong/str /doc I found results that is fine : arr name=country,state,district,event lst str name=fieldcountry/str str name=valueindia/str int name=count1/int arr name=pivot lst str name=fieldstate/str str name=valuemaharashtra/str int name=count1/int arr name=pivot/arr lst str name=fieldstate/str str name=valueHaryana/str int name=count1/int arr name=pivot lst str name=fielddistrict/str str name=valueFaridabad/str int name=count1/int /lst /arr /lst /arr /lst /arr /lst lst str name=fieldcountry/str str name=valuechina/str int name=count1/int arr name=pivot lst str name=fieldstate/str /lst /arr But if my document have multiple location like : doc arr name=location strjapan|JAPAN|null|/str str brisbane|Australia|Queensland /str str afghanistan|AFGHANISTAN|null /str /arr /doc doc arr name=location str afghanistan|AFGHANISTAN|null /str /arr /doc doc arr name=location str brisbane|Australia|Queensland /str /str /arr /doc Can anyone tell , me how should i put data in solr index to get hierarical data. Thanks Varsha -- Thanks Regards Varsha
Re: Hierarchical Faceting
: Subject: Hierarchical Faceting : References: : 15062_1368600769_zzi0n0aykpk6h.00_519330be.7000...@uni-bielefeld.de : In-Reply-To: : 15062_1368600769_zzi0n0aykpk6h.00_519330be.7000...@uni-bielefeld.de https://people.apache.org/~hossman/#threadhijack Thread Hijacking on Mailing Lists When starting a new discussion on a mailing list, please do not reply to an existing message, instead start a fresh email. Even if you change the subject line of your email, other mail headers still track which thread you replied to and your question is hidden in that thread and gets less attention. It makes following discussions in the mailing list archives particularly difficult. -Hoss
How to add prefix tokens for hierarchical faceting when using DIH?
Hi, I am trying to figure out a way to add prefix tokens to SOLR document using DIH for hierarchical faceting Ex: -Parent hierarchy +child hierarchy1 +child hierarchy2 I couldn't really use PathHierarchyTokenizerFactory as I dont see a way to control the depth of the hierarchy hence I thought of using face.prefix approach to index the document along with prefix(something like below). Doc#1: 0/NonFic, 1/NonFic/Law Doc#2: 0/NonFic, 1/NonFic/Sci Doc#3: 0/NonFic, 1/NonFic/Hist, I am not sure if I can implement the abolve indexing (indexing along with prefix tokens for each path) using template transformers in DIH. Can someone please clarify or provide me with pointers? Thanks, BB -- View this message in context: http://lucene.472066.n3.nabble.com/How-to-add-prefix-tokens-for-hierarchical-faceting-when-using-DIH-tp4006667.html Sent from the Solr - User mailing list archive at Nabble.com.
Re: Hierarchical faceting and filter query exclusions
Thanks, Erick. I have looked at the documentation at length and done a number of tests. I don't see a way to do exclusions with hierarchical facets. Thanks, Nick On Aug 29, 2012, at 9:50 PM, Erick Erickson erickerick...@gmail.com wrote: See Tagging and excluding filters here: http://lucidworks.lucidimagination.com/display/solr/Faceting Best Erick On Wed, Aug 29, 2012 at 11:44 AM, Nicholas Swarr nsw...@glgroup.com wrote: We're using Solr 4.0 Beta, testing the hierarchical faceting support to see if it's a good fit to facet on taxonomies. One issue we've encountered is that we can't apply filter exclusions to the hierarchical facets so as to preserve facet count with multi-select. I haven't been able to locate or otherwise determine if there's documentation that would outline how this is done. We've tried a few things with local params but it appears those aren't parsed with the facet.pivot argument. I found this ticket related to that: https://issues.apache.org/jira/browse/SOLR-2255 Could anyone offer some insight or guidance on this? Thanks, Nick This e-mail message, and any attachments, is intended only for the use of the individual or entity identified in the alias address of this message and may contain information that is confidential, privileged and subject to legal restrictions and penalties regarding its unauthorized disclosure and use. Any unauthorized review, copying, disclosure, use or distribution is strictly prohibited. If you have received this e-mail message in error, please notify the sender immediately by reply e-mail and delete this message, and any attachments, from your system. Thank you. This e-mail message, and any attachments, is intended only for the use of the individual or entity identified in the alias address of this message and may contain information that is confidential, privileged and subject to legal restrictions and penalties regarding its unauthorized disclosure and use. Any unauthorized review, copying, disclosure, use or distribution is strictly prohibited. If you have received this e-mail message in error, please notify the sender immediately by reply e-mail and delete this message, and any attachments, from your system. Thank you.
Re: Hierarchical faceting and filter query exclusions
. Thanks, Nick On Aug 29, 2012, at 9:50 PM, Erick Erickson erickerick...@gmail.com wrote: See Tagging and excluding filters here: http://lucidworks.lucidimagination.com/display/solr/Faceting Best Erick On Wed, Aug 29, 2012 at 11:44 AM, Nicholas Swarr nsw...@glgroup.com wrote: We're using Solr 4.0 Beta, testing the hierarchical faceting support to see if it's a good fit to facet on taxonomies. One issue we've encountered is that we can't apply filter exclusions to the hierarchical facets so as to preserve facet count with multi-select. I haven't been able to locate or otherwise determine if there's documentation that would outline how this is done. We've tried a few things with local params but it appears those aren't parsed with the facet.pivot argument. I found this ticket related to that: https://issues.apache.org/jira/browse/SOLR-2255 Could anyone offer some insight or guidance on this? Thanks, Nick This e-mail message, and any attachments, is intended only for the use of the individual or entity identified in the alias address of this message and may contain information that is confidential, privileged and subject to legal restrictions and penalties regarding its unauthorized disclosure and use. Any unauthorized review, copying, disclosure, use or distribution is strictly prohibited. If you have received this e-mail message in error, please notify the sender immediately by reply e-mail and delete this message, and any attachments, from your system. Thank you. This e-mail message, and any attachments, is intended only for the use of the individual or entity identified in the alias address of this message and may contain information that is confidential, privileged and subject to legal restrictions and penalties regarding its unauthorized disclosure and use. Any unauthorized review, copying, disclosure, use or distribution is strictly prohibited. If you have received this e-mail message in error, please notify the sender immediately by reply e-mail and delete this message, and any attachments, from your system. Thank you.
Hierarchical faceting and filter query exclusions
We're using Solr 4.0 Beta, testing the hierarchical faceting support to see if it's a good fit to facet on taxonomies. One issue we've encountered is that we can't apply filter exclusions to the hierarchical facets so as to preserve facet count with multi-select. I haven't been able to locate or otherwise determine if there's documentation that would outline how this is done. We've tried a few things with local params but it appears those aren't parsed with the facet.pivot argument. I found this ticket related to that: https://issues.apache.org/jira/browse/SOLR-2255 Could anyone offer some insight or guidance on this? Thanks, Nick This e-mail message, and any attachments, is intended only for the use of the individual or entity identified in the alias address of this message and may contain information that is confidential, privileged and subject to legal restrictions and penalties regarding its unauthorized disclosure and use. Any unauthorized review, copying, disclosure, use or distribution is strictly prohibited. If you have received this e-mail message in error, please notify the sender immediately by reply e-mail and delete this message, and any attachments, from your system. Thank you.
Re: Hierarchical faceting and filter query exclusions
See Tagging and excluding filters here: http://lucidworks.lucidimagination.com/display/solr/Faceting Best Erick On Wed, Aug 29, 2012 at 11:44 AM, Nicholas Swarr nsw...@glgroup.com wrote: We're using Solr 4.0 Beta, testing the hierarchical faceting support to see if it's a good fit to facet on taxonomies. One issue we've encountered is that we can't apply filter exclusions to the hierarchical facets so as to preserve facet count with multi-select. I haven't been able to locate or otherwise determine if there's documentation that would outline how this is done. We've tried a few things with local params but it appears those aren't parsed with the facet.pivot argument. I found this ticket related to that: https://issues.apache.org/jira/browse/SOLR-2255 Could anyone offer some insight or guidance on this? Thanks, Nick This e-mail message, and any attachments, is intended only for the use of the individual or entity identified in the alias address of this message and may contain information that is confidential, privileged and subject to legal restrictions and penalties regarding its unauthorized disclosure and use. Any unauthorized review, copying, disclosure, use or distribution is strictly prohibited. If you have received this e-mail message in error, please notify the sender immediately by reply e-mail and delete this message, and any attachments, from your system. Thank you.
Re: Near Real Time + Facets + Hierarchical Faceting (Pivot Table) with Date Range: huge data set
NRT does not work because index updates hundreds times per second vs. cache warm-up time few minutes and we are in a loop allowing you to query your huge index in ms. Solr also allows to query in ms. What is the difference? No one can sort 1,000,000 terms in descending counts order faster than current Solr implementation, and FieldCache UnInvertedCache can't be used together with NRT cache discarded few times per second! - Fuad http://www.tokenizer.ca On 12-08-14 8:17 AM, Nagendra Nagarajayya nnagaraja...@transaxtions.com wrote: You should try realtime NRT available with Apache Solr 4.0 with RankingAlgorithm 1.4.4, allows faceting in realtime. RankingAlgorithm 1.4.4 also provides an age feature that allows you to retrieve the most recent changed docs in realtime, allowing you to query your huge index in ms. You can get more information and also download from here: http://solr-ra.tgels.org Regards - Nagendra Nagarajayya http://solr-ra.tgels.org http://rankingalgorithm.tgels.org ps. Note: Apache Solr 4.0 with RankingAlgorithm 1.4.4 is an external implementation On 8/13/2012 11:38 AM, Fuad Efendi wrote: SOLR-4.0 I am trying to implement this; funny idea to share: 1. http://wiki.apache.org/solr/HierarchicalFaceting unfortunately it does not support date ranges. However, workaround: use String type instead of *_tdt and define fields such as published_hour published_day published_week S( Of course you will need to stick with timezone; but you can add an index(es) for each timezone. And most important, string facets are much faster than Date Trie ranges. 2. Our index is overs 100 millions (from social networks) and rapidly grows (millions a day); cache warm up takes few minutes; Near-Real-Time does not work with faceting. HoweverS( another workaround: we can have Daily Core (optimized at midnight), plus Current Core (only today's data, optimized), plus Last Hour Core (near real time) Last Hour Data is small enough and we can use Facets with Near Real Time feature Service layer will accumulate search results from three layers, it will be near real time. Any thoughts? Thanks,
Re: Near Real Time + Facets + Hierarchical Faceting (Pivot Table) with Date Range: huge data set
You should try realtime NRT available with Apache Solr 4.0 with RankingAlgorithm 1.4.4, allows faceting in realtime. RankingAlgorithm 1.4.4 also provides an age feature that allows you to retrieve the most recent changed docs in realtime, allowing you to query your huge index in ms. You can get more information and also download from here: http://solr-ra.tgels.org Regards - Nagendra Nagarajayya http://solr-ra.tgels.org http://rankingalgorithm.tgels.org ps. Note: Apache Solr 4.0 with RankingAlgorithm 1.4.4 is an external implementation On 8/13/2012 11:38 AM, Fuad Efendi wrote: SOLR-4.0 I am trying to implement this; funny idea to share: 1. http://wiki.apache.org/solr/HierarchicalFaceting unfortunately it does not support date ranges. However, workaround: use String type instead of *_tdt and define fields such as published_hour published_day published_week S( Of course you will need to stick with timezone; but you can add an index(es) for each timezone. And most important, string facets are much faster than Date Trie ranges. 2. Our index is overs 100 millions (from social networks) and rapidly grows (millions a day); cache warm up takes few minutes; Near-Real-Time does not work with faceting. HoweverS( another workaround: we can have Daily Core (optimized at midnight), plus Current Core (only today's data, optimized), plus Last Hour Core (near real time) Last Hour Data is small enough and we can use Facets with Near Real Time feature Service layer will accumulate search results from three layers, it will be near real time. Any thoughts? Thanks,
Near Real Time + Facets + Hierarchical Faceting (Pivot Table) with Date Range: huge data set
SOLR-4.0 I am trying to implement this; funny idea to share: 1. http://wiki.apache.org/solr/HierarchicalFaceting unfortunately it does not support date ranges. However, workaround: use String type instead of *_tdt and define fields such as published_hour published_day published_week Of course you will need to stick with timezone; but you can add an index(es) for each timezone. And most important, string facets are much faster than Date Trie ranges. 2. Our index is overs 100 millions (from social networks) and rapidly grows (millions a day); cache warm up takes few minutes; Near-Real-Time does not work with faceting. However another workaround: we can have Daily Core (optimized at midnight), plus Current Core (only today's data, optimized), plus Last Hour Core (near real time) Last Hour Data is small enough and we can use Facets with Near Real Time feature Service layer will accumulate search results from three layers, it will be near real time. Any thoughts? Thanks, -- Fuad Efendi 416-993-2060 Tokenizer Inc., Canada http://www.tokenizer.ca http://www.linkedin.com/in/lucene
Re: Near Real Time + Facets + Hierarchical Faceting (Pivot Table) with Date Range: huge data set
There is a per segment faceting option - but I think just for single value fields right now? On Mon, Aug 13, 2012 at 2:38 PM, Fuad Efendi f...@efendi.ca wrote: SOLR-4.0 I am trying to implement this; funny idea to share: 1. http://wiki.apache.org/solr/HierarchicalFaceting unfortunately it does not support date ranges. However, workaround: use String type instead of *_tdt and define fields such as published_hour published_day published_week Š Of course you will need to stick with timezone; but you can add an index(es) for each timezone. And most important, string facets are much faster than Date Trie ranges. 2. Our index is overs 100 millions (from social networks) and rapidly grows (millions a day); cache warm up takes few minutes; Near-Real-Time does not work with faceting. HoweverŠ another workaround: we can have Daily Core (optimized at midnight), plus Current Core (only today's data, optimized), plus Last Hour Core (near real time) Last Hour Data is small enough and we can use Facets with Near Real Time feature Service layer will accumulate search results from three layers, it will be near real time. Any thoughts? Thanks, -- Fuad Efendi 416-993-2060 Tokenizer Inc., Canada http://www.tokenizer.ca http://www.linkedin.com/in/lucene -- - Mark http://www.lucidimagination.com
Re: hierarchical faceting?
yup. fieldType name=cq_tag class=solr.TextField positionIncrementGap=100 analyzer type=index tokenizer class=solr.PathHierarchyTokenizerFactory delimiter=$/ /analyzer analyzer type=query tokenizer class=solr.KeywordTokenizerFactory/ /analyzer /fieldType field name=colors type=cq_tag indexed=true stored=true multiValued=true/!-- red$pink, blue ... -- field name=colors_facet type=string indexed=true stored=false multiValued=true/!-- red$pink, blue ... -- copyField source=colors dest=colors_facet/ and ?facet.field=colors_facet On Mon, Apr 30, 2012 at 9:35 PM, Chris Hostetter hossman_luc...@fucit.orgwrote: : Is there a tokenizer that tokenizes the string as one token? Using KeywordTokenizer at query time should do whta you want. -Hoss
Re: hierarchical faceting?
: Is there a tokenizer that tokenizes the string as one token? Using KeywordTokenizer at query time should do whta you want. -Hoss
hierarchical faceting?
I have hierarchical colors: field name=colors type=text_pathindexed=true stored=true multiValued=true/ text_path is TextField with PathHierarchyTokenizerFactory as tokenizer. Given these two documents, Doc1: red Doc2: red/pink I want the result to be the following: ?fq=red == Doc1, Doc2 ?fq=red/pink == Doc2 But, with PathHierarchyTokenizer, Doc1 is included for the query: ?fq=red/pink == Doc1, Doc2 How can I query for hierarchical facets? http://wiki.apache.org/solr/HierarchicalFaceting describes facet.prefix.. But it looks too cumbersome to me. Is there a simpler way to implement hierarchical facets?
Re: hierarchical faceting?
Put the parent term in all the child documents at index time and the re-issue the facet query when you expand the parent using the parent's term. works perfect. On Wed, 2012-04-18 at 10:56 -0400, sam ” wrote: I have hierarchical colors: field name=colors type=text_pathindexed=true stored=true multiValued=true/ text_path is TextField with PathHierarchyTokenizerFactory as tokenizer. Given these two documents, Doc1: red Doc2: red/pink I want the result to be the following: ?fq=red == Doc1, Doc2 ?fq=red/pink == Doc2 But, with PathHierarchyTokenizer, Doc1 is included for the query: ?fq=red/pink == Doc1, Doc2 How can I query for hierarchical facets? http://wiki.apache.org/solr/HierarchicalFaceting describes facet.prefix.. But it looks too cumbersome to me. Is there a simpler way to implement hierarchical facets?
Re: hierarchical faceting?
Yah, that's exactly what PathHierarchyTokenizer does. fieldType name=text_path class=solr.TextField positionIncrementGap=100 analyzer type=index tokenizer class=solr.PathHierarchyTokenizerFactory/ /analyzer /fieldType I think I have a query time tokenizer that tokenizes at / ?q=colors:red == Doc1, Doc2 ?q=colors:redfoobar == ?q=colors:red/foobarasdfoaijao == Doc1, Doc2 On Wed, Apr 18, 2012 at 11:10 AM, Darren Govoni dar...@ontrenet.com wrote: Put the parent term in all the child documents at index time and the re-issue the facet query when you expand the parent using the parent's term. works perfect. On Wed, 2012-04-18 at 10:56 -0400, sam ” wrote: I have hierarchical colors: field name=colors type=text_pathindexed=true stored=true multiValued=true/ text_path is TextField with PathHierarchyTokenizerFactory as tokenizer. Given these two documents, Doc1: red Doc2: red/pink I want the result to be the following: ?fq=red == Doc1, Doc2 ?fq=red/pink == Doc2 But, with PathHierarchyTokenizer, Doc1 is included for the query: ?fq=red/pink == Doc1, Doc2 How can I query for hierarchical facets? http://wiki.apache.org/solr/HierarchicalFaceting describes facet.prefix.. But it looks too cumbersome to me. Is there a simpler way to implement hierarchical facets?
Re: hierarchical faceting?
It looks like TextField is the problem. This fixed: fieldType name=text_path class=solr.TextField positionIncrementGap=100 analyzer type=index tokenizer class=solr.PathHierarchyTokenizerFactory delimiter=// /analyzer analyzer type=query tokenizer class=solr.WhitespaceTokenizerFactory/ /analyzer /fieldType I am assuming the text_path fields won't include whitespace characters. ?q=colors:red/pink == Doc2 (Doc1, which has colors = red isn't included!) Is there a tokenizer that tokenizes the string as one token? I tried to extend Tokenizer myself but it fails: public class AsIsTokenizer extends Tokenizer { @Override public boolean incrementToken() throws IOException { return true;//or false; } } On Wed, Apr 18, 2012 at 11:33 AM, sam ” skyn...@gmail.com wrote: Yah, that's exactly what PathHierarchyTokenizer does. fieldType name=text_path class=solr.TextField positionIncrementGap=100 analyzer type=index tokenizer class=solr.PathHierarchyTokenizerFactory/ /analyzer /fieldType I think I have a query time tokenizer that tokenizes at / ?q=colors:red == Doc1, Doc2 ?q=colors:redfoobar == ?q=colors:red/foobarasdfoaijao == Doc1, Doc2 On Wed, Apr 18, 2012 at 11:10 AM, Darren Govoni dar...@ontrenet.comwrote: Put the parent term in all the child documents at index time and the re-issue the facet query when you expand the parent using the parent's term. works perfect. On Wed, 2012-04-18 at 10:56 -0400, sam ” wrote: I have hierarchical colors: field name=colors type=text_pathindexed=true stored=true multiValued=true/ text_path is TextField with PathHierarchyTokenizerFactory as tokenizer. Given these two documents, Doc1: red Doc2: red/pink I want the result to be the following: ?fq=red == Doc1, Doc2 ?fq=red/pink == Doc2 But, with PathHierarchyTokenizer, Doc1 is included for the query: ?fq=red/pink == Doc1, Doc2 How can I query for hierarchical facets? http://wiki.apache.org/solr/HierarchicalFaceting describes facet.prefix.. But it looks too cumbersome to me. Is there a simpler way to implement hierarchical facets?
Re: hierarchical faceting?
I don't use any of that stuff in my app, so not sure how it works. I just manage my taxonomy outside of solr at index time and don't need any special fields or tokenizers. I use a string field type and insert the proper field at index time and query it normally. Nothing special required. On Wed, 2012-04-18 at 13:00 -0400, sam ” wrote: It looks like TextField is the problem. This fixed: fieldType name=text_path class=solr.TextField positionIncrementGap=100 analyzer type=index tokenizer class=solr.PathHierarchyTokenizerFactory delimiter=// /analyzer analyzer type=query tokenizer class=solr.WhitespaceTokenizerFactory/ /analyzer /fieldType I am assuming the text_path fields won't include whitespace characters. ?q=colors:red/pink == Doc2 (Doc1, which has colors = red isn't included!) Is there a tokenizer that tokenizes the string as one token? I tried to extend Tokenizer myself but it fails: public class AsIsTokenizer extends Tokenizer { @Override public boolean incrementToken() throws IOException { return true;//or false; } } On Wed, Apr 18, 2012 at 11:33 AM, sam ” skyn...@gmail.com wrote: Yah, that's exactly what PathHierarchyTokenizer does. fieldType name=text_path class=solr.TextField positionIncrementGap=100 analyzer type=index tokenizer class=solr.PathHierarchyTokenizerFactory/ /analyzer /fieldType I think I have a query time tokenizer that tokenizes at / ?q=colors:red == Doc1, Doc2 ?q=colors:redfoobar == ?q=colors:red/foobarasdfoaijao == Doc1, Doc2 On Wed, Apr 18, 2012 at 11:10 AM, Darren Govoni dar...@ontrenet.comwrote: Put the parent term in all the child documents at index time and the re-issue the facet query when you expand the parent using the parent's term. works perfect. On Wed, 2012-04-18 at 10:56 -0400, sam ” wrote: I have hierarchical colors: field name=colors type=text_pathindexed=true stored=true multiValued=true/ text_path is TextField with PathHierarchyTokenizerFactory as tokenizer. Given these two documents, Doc1: red Doc2: red/pink I want the result to be the following: ?fq=red == Doc1, Doc2 ?fq=red/pink == Doc2 But, with PathHierarchyTokenizer, Doc1 is included for the query: ?fq=red/pink == Doc1, Doc2 How can I query for hierarchical facets? http://wiki.apache.org/solr/HierarchicalFaceting describes facet.prefix.. But it looks too cumbersome to me. Is there a simpler way to implement hierarchical facets?
Re: hierarchical faceting?
The PathHierarchyTokenizerFactory is intended for file path therefore assumes that all documents should be indexed with all of the paths to the parent folders but you are trying to use it for a taxonomy so you can't simply use the PathHierarchyTokenizerFactory. Use the analysis page ( http://localhost:8983/solr/admin/analysis.jsp) so that you can see what's happening with the content both at index and query time. Field (Type) text_path Field value (Index) red/pink Field value (Query) red/pink You'd notice that the result of both is identical, therefore explaining why both documents are retrieved: Index Analyzer: red red/pink Query Analyzer: red red/pink Carlos -Original Message- From: Darren Govoni [mailto:dar...@ontrenet.com] Sent: Wednesday, April 18, 2012 8:10 AM To: solr-user@lucene.apache.org Subject: Re: hierarchical faceting? Put the parent term in all the child documents at index time and the re-issue the facet query when you expand the parent using the parent's term. works perfect. On Wed, 2012-04-18 at 10:56 -0400, sam ” wrote: I have hierarchical colors: field name=colors type=text_pathindexed=true stored=true multiValued=true/ text_path is TextField with PathHierarchyTokenizerFactory as tokenizer. Given these two documents, Doc1: red Doc2: red/pink I want the result to be the following: ?fq=red == Doc1, Doc2 ?fq=red/pink == Doc2 But, with PathHierarchyTokenizer, Doc1 is included for the query: ?fq=red/pink == Doc1, Doc2 How can I query for hierarchical facets? http://wiki.apache.org/solr/HierarchicalFaceting describes facet.prefix.. But it looks too cumbersome to me. Is there a simpler way to implement hierarchical facets?
Re: Retrieving multiple levels with hierarchical faceting in Solr
: I've found a couple of discussions online that suggest I ought to be : able to set the prefix using local params: : : facet.field={!prefix=0;}foo : facet.field={!prefix=1_foovalue; key=bar}foo citation please? as far as i know that has ever been implemented, but the idea was floated arround as a hypothetical. There is an open feature request for this type of logic, and it has a patch, but that patch doesn't work against any recent version (contributions to get it up to snuff would certianly be welcome)... https://issues.apache.org/jira/browse/SOLR-1351 https://issues.apache.org/jira/browse/SOLR-2251 -Hoss
Re: Retrieving multiple levels with hierarchical faceting in Solr
I should have read more carefully. Why not just use facet.query? They are treated completely independently, so you can specify something like: facet.query=field:0* facet.query=field:1_foovalue* and you can even specify facet.field as well, they all just come back as separate sections in the facets list of the response. Best Erick On Sun, Mar 4, 2012 at 7:52 AM, adrian.strin...@holidaylettings.co.uk adrian.strin...@holidaylettings.co.uk wrote: At the moment, I'm just using a multi-valued string field. I was previously using a text field that was defined as follows: fieldtype name=foo class=solr.TextField indexed=true analyzer tokenizer class=solr.WhitespaceTokenizerFactory / filter class=solr.PatternReplaceFilterFactory pattern=\+ replacement= / /analyzer /fieldtype I've tried to have a look on the net, but I can't seem to find any documentation on the difference between specifying a facet prefix using f.facetname.facet.prefix and using local params - if anyone could point me in the right direction it'd be much appreciated. From what I can see, it appears that my Solr instance just ignores the prefix when supplied via local params. I suspect that, as I don't know much about Solr, I'm probably just searching for the wrong phrases :( Regards, Ade -Original Message- From: Erick Erickson [mailto:erickerick...@gmail.com] Sent: 03 March 2012 00:36 To: solr-user@lucene.apache.org Subject: Re: Retrieving multiple levels with hierarchical faceting in Solr A lot depends on the analysis chain your field is actually using, that is the tokens that are in the index. Can you supply the schema.xml file for the field in question? Best Erick On Fri, Mar 2, 2012 at 7:21 AM, adrian.strin...@holidaylettings.co.uk adrian.strin...@holidaylettings.co.uk wrote: I've got a hierarchical facet in my Solr collection; root level values are prefixed with 0;, and the next level is prefixed 1_foovalue;. I can get the root level easily enough, but when foovalue is selected I need to retrieve the next level in the hierarchy while still displaying all of the options in the root level. I can't work out how to request either two different prefixes for the facet, or the same facet twice using different prefixes. I've found a couple of discussions online that suggest I ought to be able to set the prefix using local params: facet.field={!prefix=0;}foo facet.field={!prefix=1_foovalue; key=bar}foo but the prefix seems to be ignored, as the facet returned contains all values. Should I just copyField source=foo dest=bar / so I can query using f.foo.facet.prefix=0;f.bar.facet.prefix=1_foovalue;, or is there another way I can request the two different levels of my facet hierarchy at once? I'm using Solr 3.5. Thanks, Ade
RE: Retrieving multiple levels with hierarchical faceting in Solr
At the moment, I'm just using a multi-valued string field. I was previously using a text field that was defined as follows: fieldtype name=foo class=solr.TextField indexed=true analyzer tokenizer class=solr.WhitespaceTokenizerFactory / filter class=solr.PatternReplaceFilterFactory pattern=\+ replacement= / /analyzer /fieldtype I've tried to have a look on the net, but I can't seem to find any documentation on the difference between specifying a facet prefix using f.facetname.facet.prefix and using local params - if anyone could point me in the right direction it'd be much appreciated. From what I can see, it appears that my Solr instance just ignores the prefix when supplied via local params. I suspect that, as I don't know much about Solr, I'm probably just searching for the wrong phrases :( Regards, Ade -Original Message- From: Erick Erickson [mailto:erickerick...@gmail.com] Sent: 03 March 2012 00:36 To: solr-user@lucene.apache.org Subject: Re: Retrieving multiple levels with hierarchical faceting in Solr A lot depends on the analysis chain your field is actually using, that is the tokens that are in the index. Can you supply the schema.xml file for the field in question? Best Erick On Fri, Mar 2, 2012 at 7:21 AM, adrian.strin...@holidaylettings.co.uk adrian.strin...@holidaylettings.co.uk wrote: I've got a hierarchical facet in my Solr collection; root level values are prefixed with 0;, and the next level is prefixed 1_foovalue;. I can get the root level easily enough, but when foovalue is selected I need to retrieve the next level in the hierarchy while still displaying all of the options in the root level. I can't work out how to request either two different prefixes for the facet, or the same facet twice using different prefixes. I've found a couple of discussions online that suggest I ought to be able to set the prefix using local params: facet.field={!prefix=0;}foo facet.field={!prefix=1_foovalue; key=bar}foo but the prefix seems to be ignored, as the facet returned contains all values. Should I just copyField source=foo dest=bar / so I can query using f.foo.facet.prefix=0;f.bar.facet.prefix=1_foovalue;, or is there another way I can request the two different levels of my facet hierarchy at once? I'm using Solr 3.5. Thanks, Ade
Retrieving multiple levels with hierarchical faceting in Solr
I've got a hierarchical facet in my Solr collection; root level values are prefixed with 0;, and the next level is prefixed 1_foovalue;. I can get the root level easily enough, but when foovalue is selected I need to retrieve the next level in the hierarchy while still displaying all of the options in the root level. I can't work out how to request either two different prefixes for the facet, or the same facet twice using different prefixes. I've found a couple of discussions online that suggest I ought to be able to set the prefix using local params: facet.field={!prefix=0;}foo facet.field={!prefix=1_foovalue; key=bar}foo but the prefix seems to be ignored, as the facet returned contains all values. Should I just copyField source=foo dest=bar / so I can query using f.foo.facet.prefix=0;f.bar.facet.prefix=1_foovalue;, or is there another way I can request the two different levels of my facet hierarchy at once? I'm using Solr 3.5. Thanks, Ade
Re: Retrieving multiple levels with hierarchical faceting in Solr
A lot depends on the analysis chain your field is actually using, that is the tokens that are in the index. Can you supply the schema.xml file for the field in question? Best Erick On Fri, Mar 2, 2012 at 7:21 AM, adrian.strin...@holidaylettings.co.uk adrian.strin...@holidaylettings.co.uk wrote: I've got a hierarchical facet in my Solr collection; root level values are prefixed with 0;, and the next level is prefixed 1_foovalue;. I can get the root level easily enough, but when foovalue is selected I need to retrieve the next level in the hierarchy while still displaying all of the options in the root level. I can't work out how to request either two different prefixes for the facet, or the same facet twice using different prefixes. I've found a couple of discussions online that suggest I ought to be able to set the prefix using local params: facet.field={!prefix=0;}foo facet.field={!prefix=1_foovalue; key=bar}foo but the prefix seems to be ignored, as the facet returned contains all values. Should I just copyField source=foo dest=bar / so I can query using f.foo.facet.prefix=0;f.bar.facet.prefix=1_foovalue;, or is there another way I can request the two different levels of my facet hierarchy at once? I'm using Solr 3.5. Thanks, Ade
Re: Hierarchical faceting with solr 1.4 version
Well, a lot depends on how you need to query. The simplest would be to store triplets MSA/Area/Hood, that is denormalize the data and store each. If you used a multiValued field to store it, you could do some tricky dancing with positionIncrementGap to insure that matches occurred as you wish. But if that doesn't make sense, perhaps you could expand on the kinds of queries that need to happen. Best Erick On Wed, Feb 1, 2012 at 12:58 AM, Gupta, Veeranjaneya veeranjaneya.gu...@travelocity.com wrote: Hi, I am using SOLR1.4 version. I have a requirement to display the data as below. Polygon id=TX172- type=MSA name=Dallas/Ft. Worth dictionaryId=297224 Polygon id=TX172-0200 type=Area name=Denton dictionaryId=296635/ Polygon id=TX172-1000 type=Area name=Grand Prairie dictionaryId=400702 Polygon id=TX172-0601 type=Hood name=Entertainment District dictionaryId=14993/ Polygon id=TX172-0404 type=Hood name=South Dallas dictionaryId=279265/ /Polygon Polygon id=TX172-0800 type=Area name=Northeast Dallas dictionaryId=297286 Polygon id=TX172-0809 type=Hood name=Park Central dictionaryId=15424/ Polygon id=TX172-0808 type=Hood name=Addison dictionaryId=15384/ Polygon id=TX172-0807 type=Hood name=Galleria dictionaryId=15417/ /Polygon Polygon id=TX172-0300 type=Area name=Fort Worth dictionaryId=296683 Polygon id=TX172-0305 type=Hood name=TCU and Forest Park dictionaryId=279770/ Polygon id=TX172-0303 type=Hood name=North Fort Worth and Fossil Creek dictionaryId=278905/ Polygon id=TX172-0302 type=Hood name=Alliance and Texas Motor Speedway dictionaryId=296856/ /Polygon /Polygon Here we store 3 types of polygons MSA, AREA and HOOD. One MSA can have more than one AREA types as children and one AREA can have more than one HOOD types as children. How to store this kind of data in solr and how to query the solr to get this hierarchical data? Thanks, Gupta
Re: Hierarchical faceting in UI
: References: : CAO9-Pr72dWKyHVtSxwHdUM_2756VGXAFuqPpK-yeVn6gM_V=d...@mail.gmail.com : Message-ID: 1327357980.36539.yahoomail...@web160302.mail.bf1.yahoo.com : Subject: Hierarchical faceting in UI https://people.apache.org/~hossman/#threadhijack Thread Hijacking on Mailing Lists When starting a new discussion on a mailing list, please do not reply to an existing message, instead start a fresh email. Even if you change the subject line of your email, other mail headers still track which thread you replied to and your question is hidden in that thread and gets less attention. It makes following discussions in the mailing list archives particularly difficult. -Hoss
Re: Hierarchical faceting in UI
I'm not really following your specific example, but a worked through example of the index full breadcrumb type approach darren was suggesting for doing drill down i na hierarchy is described in slides 32-35 of this presentation (which was recorded as a webcast)... http://people.apache.org/%7Ehossman/apachecon2010/facets/ http://www.lucidimagination.com/why-lucid/webinars/mastering-power-faceted-search in general, i *strongly* recommend that you use unique ids for each node of your taxonomy as a way to avoid confusion when multiple nodes have the same label/name. (in the presentation i talk about doing that, but the slides show simple strings to help viewers follow what's going on) -Hoss
Hierarchical faceting with solr 1.4 version
Hi, I am using SOLR1.4 version. I have a requirement to display the data as below. Polygon id=TX172- type=MSA name=Dallas/Ft. Worth dictionaryId=297224 Polygon id=TX172-0200 type=Area name=Denton dictionaryId=296635/ Polygon id=TX172-1000 type=Area name=Grand Prairie dictionaryId=400702 Polygon id=TX172-0601 type=Hood name=Entertainment District dictionaryId=14993/ Polygon id=TX172-0404 type=Hood name=South Dallas dictionaryId=279265/ /Polygon Polygon id=TX172-0800 type=Area name=Northeast Dallas dictionaryId=297286 Polygon id=TX172-0809 type=Hood name=Park Central dictionaryId=15424/ Polygon id=TX172-0808 type=Hood name=Addison dictionaryId=15384/ Polygon id=TX172-0807 type=Hood name=Galleria dictionaryId=15417/ /Polygon Polygon id=TX172-0300 type=Area name=Fort Worth dictionaryId=296683 Polygon id=TX172-0305 type=Hood name=TCU and Forest Park dictionaryId=279770/ Polygon id=TX172-0303 type=Hood name=North Fort Worth and Fossil Creek dictionaryId=278905/ Polygon id=TX172-0302 type=Hood name=Alliance and Texas Motor Speedway dictionaryId=296856/ /Polygon /Polygon Here we store 3 types of polygons MSA, AREA and HOOD. One MSA can have more than one AREA types as children and one AREA can have more than one HOOD types as children. How to store this kind of data in solr and how to query the solr to get this hierarchical data? Thanks, Gupta
Re: Hierarchical faceting in UI
Darren, One challenge for me is that a term can appear in multiple places of the hierarchy. So it's not safe to simply use the term as it appears to get its children; I probably need to include the entire tree path up to this term. For example, if the hierarchy is Cardiovascular Diseases Arteriosclerosis Coronary Artery Disease, and I'm getting the children of the middle term Arteriosclerosi, I need to filter on something like parent:Cardiovascular Diseases/Arteriosclerosis. I'm having trouble figuring out how I can get the complete path per above to add to the URL of each facet term. I know velocity/facet_field.vm is where I build the URL. I know how to simply add a parent:term filter to the URL. But I don't know how to access a document field, like the complete parent path, in facet_field.vm. Any help would be great. Yuhao From: dar...@ontrenet.com dar...@ontrenet.com To: Yuhao nfsvi...@yahoo.com Cc: solr-user@lucene.apache.org Sent: Monday, January 23, 2012 7:16 PM Subject: Re: Hierarchical faceting in UI On Mon, 23 Jan 2012 14:33:00 -0800 (PST), Yuhao nfsvi...@yahoo.com wrote: Programmatically, something like this might work: for each facet field, add another hidden field that identifies its parent. Then, program additional logic in the UI to show only the facet terms at the currently selected level. For example, if one filters on cat:electronics, the new UI logic would apply the additional filter cat_parent:electronics. Can this be done? Yes. This is how I do it. Would it be a lot of work? No. Its not a lot of work, simply represent your hierarchy as parent/child relations in the document fields and in your UI drill down by issuing new faceted searches. Use the current facet (tree level) as the parent:level in the next query. Its much easier than other suggestions for this. Is there a better way? Not in my opinion, there isn't. This is the simplest to implement and understand. By the way, Flamenco (another faceted browser) has built-in support for hierarchies, and it has worked well for my data in this aspect (but less well than Solr in others). I'm looking for the same kind of hierarchical UI feature in Solr.
Re: Hierarchical faceting in UI
Yuhao, Ok, let me think about this. A term can have multiple parents. Each of those parents would be 'different', yes? In this case, use a multivalued field for the parent and add all the parent names or id's to it. The relations should be unique. Your UI will associate the correct parent id to build the facet query from and return the correct children because the user is descending down a specific path in the UI and the parent node unique id's are returned along the way. Now, if you are having parent names/id's that themselves can appear in multiple locations (vs. just terms 'the leafs'), then perhaps your hierarchy needs refactoring for redundancy? Happy to help with more details. Darren On 01/24/2012 11:22 AM, Yuhao wrote: Darren, One challenge for me is that a term can appear in multiple places of the hierarchy. So it's not safe to simply use the term as it appears to get its children; I probably need to include the entire tree path up to this term. For example, if the hierarchy is Cardiovascular Diseases Arteriosclerosis Coronary Artery Disease, and I'm getting the children of the middle term Arteriosclerosi, I need to filter on something like parent:Cardiovascular Diseases/Arteriosclerosis. I'm having trouble figuring out how I can get the complete path per above to add to the URL of each facet term. I know velocity/facet_field.vm is where I build the URL. I know how to simply add a parent:term filter to the URL. But I don't know how to access a document field, like the complete parent path, in facet_field.vm. Any help would be great. Yuhao From: dar...@ontrenet.comdar...@ontrenet.com To: Yuhaonfsvi...@yahoo.com Cc: solr-user@lucene.apache.org Sent: Monday, January 23, 2012 7:16 PM Subject: Re: Hierarchical faceting in UI On Mon, 23 Jan 2012 14:33:00 -0800 (PST), Yuhaonfsvi...@yahoo.com wrote: Programmatically, something like this might work: for each facet field, add another hidden field that identifies its parent. Then, program additional logic in the UI to show only the facet terms at the currently selected level. For example, if one filters on cat:electronics, the new UI logic would apply the additional filter cat_parent:electronics. Can this be done? Yes. This is how I do it. Would it be a lot of work? No. Its not a lot of work, simply represent your hierarchy as parent/child relations in the document fields and in your UI drill down by issuing new faceted searches. Use the current facet (tree level) as the parent:level in the next query. Its much easier than other suggestions for this. Is there a better way? Not in my opinion, there isn't. This is the simplest to implement and understand. By the way, Flamenco (another faceted browser) has built-in support for hierarchies, and it has worked well for my data in this aspect (but less well than Solr in others). I'm looking for the same kind of hierarchical UI feature in Solr.
Re: Hierarchical faceting in UI
Hi Darren. You said: Your UI will associate the correct parent id to build the facet query This is the part I'm having trouble figuring out how to accomplish and some guidance would help. How would I get the value of the parent to build the facet query in the UI, if the value is in another document field? I was imagining that I would add the additional filter of parent:parent path to the fq URL parameter. But I don't have a way to do it yet. Perhaps seeing some data would help. Here is a record in old (flattened) and new (parent-enabled) versions, both in JSON format: OLD: { ID : 3816, Gene Symbol : KLK1, Alternate Names : hCG_22931;Klk6;hK1;KLKR, Description : Kallikrein 1, a peptidase that cleaves kininogen, functions in glucose homeostasis, heart contraction, semen liquefaction, and vasoconstriction, aberrantly expressed in pancreatitis and endometrial cancer; gene polymorphism correlates with kidney failure (BKL), GAD_Positive_Disease_Associations : [Mental Disorders(MESH:D001523) Dementia, Vascular(MESH:D015140), Cardiovascular Diseases(MESH:D002318) Coronary Artery Disease(MESH:D003324)], HuGENet_GeneProspector_Associations : [atherosclerosis, HDL], } NEW: { ID : 3816, Gene Symbol : KLK1, Alternate Names : hCG_22931;Klk6;hK1;KLKR, Description : Kallikrein 1, a peptidase that cleaves kininogen, functions in glucose homeostasis, heart contraction, semen liquefaction, and vasoconstriction, aberrantly expressed in pancreatitis and endometrial cancer; gene polymorphism correlates with kidney failure (BKL), GAD_Positive_Disease_Associations : [Dementia, Vascular(MESH:D015140), Coronary Artery Disease(MESH:D003324)], GAD_Positive_Disease_Associations_parent : [Mental Disorders(MESH:D001523), Cardiovascular Diseases(MESH:D002318)], HuGENet_GeneProspector_Associations : [atherosclerosis, HDL], } In the old version, the field GAD_Positive_Disease_Associations had 2 levels of hierarchy that were flattened. It had the full path of the hierarchy leading to the current term. In the new version, the field only has the current term. A separate field called GAD_Positive_Disease_Associations_parent has the full path preceding the current term. So, let's say in the UI, I click on the term Dementia, Vascular(MESH:D015140) to get its child terms and data. My filters in the URL querystring would be exactly: fq=GAD_Positive_Disease_Associations:Dementia, Vascular(MESH:D015140)fq=GAD_Positive_Disease_Associations_parent:Mental Disorders(MESH:D001523) My question is, how to get the parent value of Mental Disorders(MESH:D001523) to build that querystring? Thanks! Yuhao From: Darren Govoni dar...@ontrenet.com To: solr-user@lucene.apache.org Sent: Tuesday, January 24, 2012 1:23 PM Subject: Re: Hierarchical faceting in UI Yuhao, Ok, let me think about this. A term can have multiple parents. Each of those parents would be 'different', yes? In this case, use a multivalued field for the parent and add all the parent names or id's to it. The relations should be unique. Your UI will associate the correct parent id to build the facet query from and return the correct children because the user is descending down a specific path in the UI and the parent node unique id's are returned along the way. Now, if you are having parent names/id's that themselves can appear in multiple locations (vs. just terms 'the leafs'), then perhaps your hierarchy needs refactoring for redundancy? Happy to help with more details. Darren On 01/24/2012 11:22 AM, Yuhao wrote: Darren, One challenge for me is that a term can appear in multiple places of the hierarchy. So it's not safe to simply use the term as it appears to get its children; I probably need to include the entire tree path up to this term. For example, if the hierarchy is Cardiovascular Diseases Arteriosclerosis Coronary Artery Disease, and I'm getting the children of the middle term Arteriosclerosi, I need to filter on something like parent:Cardiovascular Diseases/Arteriosclerosis. I'm having trouble figuring out how I can get the complete path per above to add to the URL of each facet term. I know velocity/facet_field.vm is where I build the URL. I know how to simply add a parent:term filter to the URL. But I don't know how to access a document field, like the complete parent path, in facet_field.vm. Any help would be great. Yuhao From: dar...@ontrenet.comdar...@ontrenet.com To: Yuhaonfsvi...@yahoo.com Cc: solr-user@lucene.apache.org Sent: Monday, January 23, 2012 7:16 PM Subject: Re: Hierarchical faceting in UI On Mon, 23 Jan 2012 14:33:00 -0800 (PST), Yuhaonfsvi...@yahoo.com wrote: Programmatically, something like this might work: for each facet field, add another hidden field
Hierarchical faceting in UI
I have some hierarchical data that I want to represent in the Solr UI (/browse). I've read through many discussions on this topic, including http://wiki.apache.org/solr/HierarchicalFaceting and http://packtlib.packtpub.com/library/9781849516068/ch06lvl1sec09 . However, I didn't see a solution that solves case. For each facet field in my data, the depth varies depending on the facet term. For example, at the root level, facet term 1 may have 3 levels down, but facet term 2 will have 8 levels down. In the UI, I want to show only the facet terms at the currently selected level. Using the example that comes with Solr, the facet cat has the field electronics, which then has several children. When my user initially enters the UI, he should only see electronics; he should not see any of its children until he clicks on electronics. Programmatically, something like this might work: for each facet field, add another hidden field that identifies its parent. Then, program additional logic in the UI to show only the facet terms at the currently selected level. For example, if one filters on cat:electronics, the new UI logic would apply the additional filter cat_parent:electronics. Can this be done? Would it be a lot of work? Is there a better way? By the way, Flamenco (another faceted browser) has built-in support for hierarchies, and it has worked well for my data in this aspect (but less well than Solr in others). I'm looking for the same kind of hierarchical UI feature in Solr.
Re: Hierarchical faceting in UI
On Mon, 23 Jan 2012 14:33:00 -0800 (PST), Yuhao nfsvi...@yahoo.com wrote: Programmatically, something like this might work: for each facet field, add another hidden field that identifies its parent. Then, program additional logic in the UI to show only the facet terms at the currently selected level. For example, if one filters on cat:electronics, the new UI logic would apply the additional filter cat_parent:electronics. Can this be done? Yes. This is how I do it. Would it be a lot of work? No. Its not a lot of work, simply represent your hierarchy as parent/child relations in the document fields and in your UI drill down by issuing new faceted searches. Use the current facet (tree level) as the parent:level in the next query. Its much easier than other suggestions for this. Is there a better way? Not in my opinion, there isn't. This is the simplest to implement and understand. By the way, Flamenco (another faceted browser) has built-in support for hierarchies, and it has worked well for my data in this aspect (but less well than Solr in others). I'm looking for the same kind of hierarchical UI feature in Solr.
Re: Hierarchical faceting in UI
another way is to store the original hierarchy in a sql database (in the form: id, parent_id, name, level) and in the Lucene index store the complete hierarchy (from root to leave node) for each document in one field using the ids of the sql database. In that way you can get documents at any level of the hierarchy. You can use the sql database to dynamically expand the tree by building facet queries to fetch document collections of child-nodes. Johannes from the root level down to leave node in one field 1 13 32 42 23 12 2012/1/23 dar...@ontrenet.com: On Mon, 23 Jan 2012 14:33:00 -0800 (PST), Yuhao nfsvi...@yahoo.com wrote: Programmatically, something like this might work: for each facet field, add another hidden field that identifies its parent. Then, program additional logic in the UI to show only the facet terms at the currently selected level. For example, if one filters on cat:electronics, the new UI logic would apply the additional filter cat_parent:electronics. Can this be done? Yes. This is how I do it. Would it be a lot of work? No. Its not a lot of work, simply represent your hierarchy as parent/child relations in the document fields and in your UI drill down by issuing new faceted searches. Use the current facet (tree level) as the parent:level in the next query. Its much easier than other suggestions for this. Is there a better way? Not in my opinion, there isn't. This is the simplest to implement and understand. By the way, Flamenco (another faceted browser) has built-in support for hierarchies, and it has worked well for my data in this aspect (but less well than Solr in others). I'm looking for the same kind of hierarchical UI feature in Solr.
Re: Hierarchical faceting with Date
You count index the date as a text field(or use a new text field to store date as text) and then try it on this new field Thanx Pravesh -- View this message in context: http://lucene.472066.n3.nabble.com/Hierarchical-faceting-with-Date-tp3394521p3395824.html Sent from the Solr - User mailing list archive at Nabble.com.
Hierarchical faceting with Date
Hi, I'm trying to perform a hierarchical (pivot) faceted search and it doesn't work with date (as one of the field). My questions are 1. Is this a supported feature or just a bug that needs to be addressed? 2. If it is not intended to be supported, what is the complexity involved in implementing it. FYI I'm using a SOLR 4.0 build from 09/30/2011. Regards Ravi Bulusu
Re: hierarchical faceting in Solr?
Cheers, very good, congratulations 2011/8/23 Naomi Dushay ndus...@stanford.edu Chris Beer just did a revamp of the wiki page at: http://wiki.apache.org/solr/**HierarchicalFacetinghttp://wiki.apache.org/solr/HierarchicalFaceting Yay Chris! - Naomi ( ... and I helped!) On Aug 22, 2011, at 10:49 AM, Naomi Dushay wrote: Chris, Is there a document somewhere on how to do this? If not, might you create one? I could even imagine such a document living on the Solr wiki ... this one has mostly ancient content: http://wiki.apache.org/solr/**HierarchicalFacetinghttp://wiki.apache.org/solr/HierarchicalFaceting - Naomi -- *Alexei Martchenko* | *CEO* | Superdownloads ale...@superdownloads.com.br | ale...@martchenko.com.br | (11) 5083.1018/5080.3535/5080.3533
Re: hierarchical faceting in Solr?
Chris Beer just did a revamp of the wiki page at: http://wiki.apache.org/solr/HierarchicalFaceting Yay Chris! - Naomi ( ... and I helped!) On Aug 22, 2011, at 10:49 AM, Naomi Dushay wrote: Chris, Is there a document somewhere on how to do this? If not, might you create one? I could even imagine such a document living on the Solr wiki ... this one has mostly ancient content: http://wiki.apache.org/solr/HierarchicalFaceting - Naomi
hierarchical faceting in Solr?
Chris, Is there a document somewhere on how to do this? If not, might you create one? I could even imagine such a document living on the Solr wiki ... this one has mostly ancient content: http://wiki.apache.org/solr/HierarchicalFaceting - Naomi
Re: hierarchical faceting in Solr?
Try searching the Solr user's list for hierarchical, this topic has been discussed numerous times. It would be great if you could collate the various solutions and update the wiki, all you have to do is create a login... Best Erick On Mon, Aug 22, 2011 at 1:49 PM, Naomi Dushay ndus...@stanford.edu wrote: Chris, Is there a document somewhere on how to do this? If not, might you create one? I could even imagine such a document living on the Solr wiki ... this one has mostly ancient content: http://wiki.apache.org/solr/HierarchicalFaceting - Naomi
Re: hierarchical faceting in Solr?
Naomi, Just create a login and update it!! On 8/22/11 12:27 PM, Erick Erickson erickerick...@gmail.com wrote: Try searching the Solr user's list for hierarchical, this topic has been discussed numerous times. It would be great if you could collate the various solutions and update the wiki, all you have to do is create a login... Best Erick On Mon, Aug 22, 2011 at 1:49 PM, Naomi Dushay ndus...@stanford.edu wrote: Chris, Is there a document somewhere on how to do this? If not, might you create one? I could even imagine such a document living on the Solr wiki ... this one has mostly ancient content: http://wiki.apache.org/solr/HierarchicalFaceting - Naomi
Re: hierarchical faceting, SOLR-792 - confused on config
On Wed, 2011-03-16 at 18:36 +0100, Erik Hatcher wrote: Sorry, I missed the original mail on this thread I put together that hierarchical faceting wiki page a couple of years ago when helping a customer evaluate SOLR-64 vs. SOLR-792 vs.other approaches. Since then, SOLR-792 morphed and is committed as pivot faceting. SOLR-64 spawned a PathTokenizer which is part of Solr now too. Recently Toke updated that page with some additional info. It's definitely not a how to page, and perhaps should get renamed/moved/revamped? Toke? Unfortunately or luckily, depending on ones point of view, I am hit by a child #3 and buying house combo. A lot of intentions, but no promises for the next month or two. I think we need both an overview and a detailed how-to of the different angles on extended faceting in Solr, seen from a user-perspective. I am not sure I fully understand the different methods myself, so maybe we could start by discussing them here? Below is a quick outline of how I see them; please expand correct. I plan to back up the claims about scale later with a wiki-page with performance tests. http://www.lucidimagination.com/solutions/webcasts/faceting @27-33 min: - Requires the user to transform the paths to multiple special terms - Step-by-step drill down: If a visual tree is needed, it requires one call for each branch. - Supports multiple paths/document - Constraints on output works just as standard faceting - Scales very well when a single branch is requested Example use case: Click-to-expand tree structure of categories for books. PathHierarchyTokenizer (trunk): Changes /A/B/C to /A, /A/B and /A/B/C. I don't know how this can be used directly for hierarchical faceting. The Lucid Imagination webcast uses the tokenization 0/A, 1/A/B and 2/A/B/C so they seem incompatible to me. The discussion on SOLR-1057 indicates that it can be used with SOLR-64, but SOLR-64 does its own tokenization!? Little help here? SOLR-64 (not up to date with trunk?): - Uses a custom tokenizer to handle delimited paths (A/B/C). - Single-path hierarchical faceting - Constraints can be given on the depth of the hierarchy but not on the number of entries at a given level (huge result set when a wide hierarchy is analyzed) - Fine (speed memory) for small taxonomies - Does not scale well (speed) to large taxonomies Example use case: Tree structure of addresses for stores. SOLR-792 aka pivot faceting (Solr 4.0): - Uses multiple independent fields as input: Not suitable for taxonomies - Multi-value but not multi-path - Supports taxonomies by restraining to single-path/document(?) - Constraints can be given on entry count, but sorting cannot be done on recursive counting of entries (and it would be very CPU expensive to do so(?)) - Fine (speed memory) for small taxonomies - Scales well (speed memory)to large taxonomies - Scales poorly (speed)to large taxonomies and large result size Example use case: Tree structure with price, rating and stock SOLR-2412 (trunk, highly experimental): - Multi-path hierarchical faceting - Uses a field with delimited paths as input (A/B/C) - Constraints can be given on depth as well as entry count, but sorting cannot be done on recursive counting of entries (the number is there though, so it would be fairly easy to add such a sorter) - Fine (speed memory) for small taxonomies - Scales well (speed memory)to large taxonomies result size Example use case: Tree structure of categories for books.
Re: hierarchical faceting, SOLR-792 - confused on config
Yes, pivot faceting is committed to trunk. But is not part of upcoming 3.1 release. Erik On Mar 16, 2011, at 15:00 , McGibbney, Lewis John wrote: Hi Erik, I have been reading about the progression of SOLR-792 into pivot faceting, however can you expand to comment on where it is committed. Are you referring to trunk? The reason I am asking is that I have been using 1.4.1 for some time now and have been thinking of upgrading to trunk... or branch Thank you Lewis From: Erik Hatcher [erik.hatc...@gmail.com] Sent: 16 March 2011 17:36 To: solr-user@lucene.apache.org Subject: Re: hierarchical faceting, SOLR-792 - confused on config Sorry, I missed the original mail on this thread I put together that hierarchical faceting wiki page a couple of years ago when helping a customer evaluate SOLR-64 vs. SOLR-792 vs.other approaches. Since then, SOLR-792 morphed and is committed as pivot faceting. SOLR-64 spawned a PathTokenizer which is part of Solr now too. Recently Toke updated that page with some additional info. It's definitely not a how to page, and perhaps should get renamed/moved/revamped? Toke? Erik Glasgow Caledonian University is a registered Scottish charity, number SC021474 Winner: Times Higher Education’s Widening Participation Initiative of the Year 2009 and Herald Society’s Education Initiative of the Year 2009. http://www.gcu.ac.uk/newsevents/news/bycategory/theuniversity/1/name,6219,en.html Winner: Times Higher Education’s Outstanding Support for Early Career Researchers of the Year 2010, GCU as a lead with Universities Scotland partners. http://www.gcu.ac.uk/newsevents/news/bycategory/theuniversity/1/name,15691,en.html
Re: hierarchical faceting, SOLR-792 - confused on config
On Mar 16, 2011, at 14:53 , Jonathan Rochkind wrote: Interesting, any documentation on the PathTokenizer anywhere? Or just have to find and look at the source? That's something I hadn't known about, which may be useful to some stuff I've been working on depending on how it works. http://wiki.apache.org/solr/AnalyzersTokenizersTokenFilters#solr.PathHierarchyTokenizerFactory Sorry, I said PathTokenizer which is what SOLR-1057 called it for a bit before it got renamed. Erik
RE: hierarchical faceting, SOLR-792 - confused on config
Hi, This is also where I am having problems. I have not been able to understand very much on the wiki. I do not understand how to configure the faceting we are referring to. Although I know very little about this, I can't help but think that the wiki is quite clearly unaccurate by some way! Any comments please Lewis From: kmf [kfole...@gmail.com] Sent: 23 February 2011 17:10 To: solr-user@lucene.apache.org Subject: Re: hierarchical faceting, SOLR-792 - confused on config I'm really confused now. Is this page completely out of date - http://wiki.apache.org/solr/HierarchicalFaceting - as it seems to imply that solr-792 is a form of hierarchical faceting. There are currently two similar, non-competing, approaches to generating tree/hierarchical facets from Solr: SOLR-64 and SOLR-792 To achieve hierarchical faceting, is the rule then that you form the hierarchical facets using a transformer in the DIH and do nothing in schema.xml or solrconfig.xml? I seem to recall reading somewhere that creating a copyField is needed. Sorry for the entry level question but, I'm still trying to understand how to configure solr to do hierarchical faceting. Thanks, kmf -- View this message in context: http://lucene.472066.n3.nabble.com/hierarchical-faceting-SOLR-792-confused-on-config-tp2556394p2561445.html Sent from the Solr - User mailing list archive at Nabble.com. Email has been scanned for viruses by Altman Technologies' email management service - www.altman.co.uk/emailsystems Glasgow Caledonian University is a registered Scottish charity, number SC021474 Winner: Times Higher Education’s Widening Participation Initiative of the Year 2009 and Herald Society’s Education Initiative of the Year 2009. http://www.gcu.ac.uk/newsevents/news/bycategory/theuniversity/1/name,6219,en.html Winner: Times Higher Education’s Outstanding Support for Early Career Researchers of the Year 2010, GCU as a lead with Universities Scotland partners. http://www.gcu.ac.uk/newsevents/news/bycategory/theuniversity/1/name,15691,en.html
Re: hierarchical faceting, SOLR-792 - confused on config
Sorry, I missed the original mail on this thread I put together that hierarchical faceting wiki page a couple of years ago when helping a customer evaluate SOLR-64 vs. SOLR-792 vs.other approaches. Since then, SOLR-792 morphed and is committed as pivot faceting. SOLR-64 spawned a PathTokenizer which is part of Solr now too. Recently Toke updated that page with some additional info. It's definitely not a how to page, and perhaps should get renamed/moved/revamped? Toke? Erik On Mar 16, 2011, at 12:39 , McGibbney, Lewis John wrote: Hi, This is also where I am having problems. I have not been able to understand very much on the wiki. I do not understand how to configure the faceting we are referring to. Although I know very little about this, I can't help but think that the wiki is quite clearly unaccurate by some way! Any comments please Lewis From: kmf [kfole...@gmail.com] Sent: 23 February 2011 17:10 To: solr-user@lucene.apache.org Subject: Re: hierarchical faceting, SOLR-792 - confused on config I'm really confused now. Is this page completely out of date - http://wiki.apache.org/solr/HierarchicalFaceting - as it seems to imply that solr-792 is a form of hierarchical faceting. There are currently two similar, non-competing, approaches to generating tree/hierarchical facets from Solr: SOLR-64 and SOLR-792 To achieve hierarchical faceting, is the rule then that you form the hierarchical facets using a transformer in the DIH and do nothing in schema.xml or solrconfig.xml? I seem to recall reading somewhere that creating a copyField is needed. Sorry for the entry level question but, I'm still trying to understand how to configure solr to do hierarchical faceting. Thanks, kmf -- View this message in context: http://lucene.472066.n3.nabble.com/hierarchical-faceting-SOLR-792-confused-on-config-tp2556394p2561445.html Sent from the Solr - User mailing list archive at Nabble.com. Email has been scanned for viruses by Altman Technologies' email management service - www.altman.co.uk/emailsystems Glasgow Caledonian University is a registered Scottish charity, number SC021474 Winner: Times Higher Education’s Widening Participation Initiative of the Year 2009 and Herald Society’s Education Initiative of the Year 2009. http://www.gcu.ac.uk/newsevents/news/bycategory/theuniversity/1/name,6219,en.html Winner: Times Higher Education’s Outstanding Support for Early Career Researchers of the Year 2010, GCU as a lead with Universities Scotland partners. http://www.gcu.ac.uk/newsevents/news/bycategory/theuniversity/1/name,15691,en.html
Re: hierarchical faceting, SOLR-792 - confused on config
Interesting, any documentation on the PathTokenizer anywhere? Or just have to find and look at the source? That's something I hadn't known about, which may be useful to some stuff I've been working on depending on how it works. If nothing else, in the meantime, I'm going to take that exact message from Erik and just add it to the top of the wiki page, to avoid other people getting confused (I've been confused by that page too) until someone spends the time to rewrite it to be more up to date and accurate, or clear about it's topicality. On 3/16/2011 1:36 PM, Erik Hatcher wrote: Sorry, I missed the original mail on this thread I put together that hierarchical faceting wiki page a couple of years ago when helping a customer evaluate SOLR-64 vs. SOLR-792 vs.other approaches. Since then, SOLR-792 morphed and is committed as pivot faceting. SOLR-64 spawned a PathTokenizer which is part of Solr now too. Recently Toke updated that page with some additional info. It's definitely not a how to page, and perhaps should get renamed/moved/revamped? Toke? Erik On Mar 16, 2011, at 12:39 , McGibbney, Lewis John wrote: Hi, This is also where I am having problems. I have not been able to understand very much on the wiki. I do not understand how to configure the faceting we are referring to. Although I know very little about this, I can't help but think that the wiki is quite clearly unaccurate by some way! Any comments please Lewis From: kmf [kfole...@gmail.com] Sent: 23 February 2011 17:10 To: solr-user@lucene.apache.org Subject: Re: hierarchical faceting, SOLR-792 - confused on config I'm really confused now. Is this page completely out of date - http://wiki.apache.org/solr/HierarchicalFaceting - as it seems to imply that solr-792 is a form of hierarchical faceting. There are currently two similar, non-competing, approaches to generating tree/hierarchical facets from Solr: SOLR-64 and SOLR-792 To achieve hierarchical faceting, is the rule then that you form the hierarchical facets using a transformer in the DIH and do nothing in schema.xml or solrconfig.xml? I seem to recall reading somewhere that creating a copyField is needed. Sorry for the entry level question but, I'm still trying to understand how to configure solr to do hierarchical faceting. Thanks, kmf -- View this message in context: http://lucene.472066.n3.nabble.com/hierarchical-faceting-SOLR-792-confused-on-config-tp2556394p2561445.html Sent from the Solr - User mailing list archive at Nabble.com. Email has been scanned for viruses by Altman Technologies' email management service - www.altman.co.uk/emailsystems Glasgow Caledonian University is a registered Scottish charity, number SC021474 Winner: Times Higher Education’s Widening Participation Initiative of the Year 2009 and Herald Society’s Education Initiative of the Year 2009. http://www.gcu.ac.uk/newsevents/news/bycategory/theuniversity/1/name,6219,en.html Winner: Times Higher Education’s Outstanding Support for Early Career Researchers of the Year 2010, GCU as a lead with Universities Scotland partners. http://www.gcu.ac.uk/newsevents/news/bycategory/theuniversity/1/name,15691,en.html
RE: hierarchical faceting, SOLR-792 - confused on config
Hi Erik, I have been reading about the progression of SOLR-792 into pivot faceting, however can you expand to comment on where it is committed. Are you referring to trunk? The reason I am asking is that I have been using 1.4.1 for some time now and have been thinking of upgrading to trunk... or branch Thank you Lewis From: Erik Hatcher [erik.hatc...@gmail.com] Sent: 16 March 2011 17:36 To: solr-user@lucene.apache.org Subject: Re: hierarchical faceting, SOLR-792 - confused on config Sorry, I missed the original mail on this thread I put together that hierarchical faceting wiki page a couple of years ago when helping a customer evaluate SOLR-64 vs. SOLR-792 vs.other approaches. Since then, SOLR-792 morphed and is committed as pivot faceting. SOLR-64 spawned a PathTokenizer which is part of Solr now too. Recently Toke updated that page with some additional info. It's definitely not a how to page, and perhaps should get renamed/moved/revamped? Toke? Erik Glasgow Caledonian University is a registered Scottish charity, number SC021474 Winner: Times Higher Education’s Widening Participation Initiative of the Year 2009 and Herald Society’s Education Initiative of the Year 2009. http://www.gcu.ac.uk/newsevents/news/bycategory/theuniversity/1/name,6219,en.html Winner: Times Higher Education’s Outstanding Support for Early Career Researchers of the Year 2010, GCU as a lead with Universities Scotland partners. http://www.gcu.ac.uk/newsevents/news/bycategory/theuniversity/1/name,15691,en.html
Re: hierarchical faceting, SOLR-792 - confused on config
(11/03/17 3:53), Jonathan Rochkind wrote: Interesting, any documentation on the PathTokenizer anywhere? It is PathHierarchyTokenizer: https://hudson.apache.org/hudson/job/Solr-trunk/javadoc/org/apache/solr/analysis/PathHierarchyTokenizerFactory.html Koji -- http://www.rondhuit.com/en/
Re: hierarchical faceting, SOLR-792 - confused on config
I'm really confused now. Is this page completely out of date - http://wiki.apache.org/solr/HierarchicalFaceting - as it seems to imply that solr-792 is a form of hierarchical faceting. There are currently two similar, non-competing, approaches to generating tree/hierarchical facets from Solr: SOLR-64 and SOLR-792 To achieve hierarchical faceting, is the rule then that you form the hierarchical facets using a transformer in the DIH and do nothing in schema.xml or solrconfig.xml? I seem to recall reading somewhere that creating a copyField is needed. Sorry for the entry level question but, I'm still trying to understand how to configure solr to do hierarchical faceting. Thanks, kmf -- View this message in context: http://lucene.472066.n3.nabble.com/hierarchical-faceting-SOLR-792-confused-on-config-tp2556394p2561445.html Sent from the Solr - User mailing list archive at Nabble.com.
hierarchical faceting, SOLR-792 - confused on config
I'm using solr 4.0 and trying to implement a hierarchical faceting example. The example I'm trying to implement is taken from the webcast Mastering the Power of Faceted Search. (http://www.lucidimagination.com/solutions/webcasts/faceting) Around minute 30, Chris Hostetter gives a very nice tips tricks example he described as Taxonomy facets. Where I'm confused is how to get the data indexed/organized into the taxonomy facets (0/NonFic, 1/NonFic/Law, 0/NonFic, 1/NonFic/Sci, 0/NonFic, 1/NonFic/Hist, 1/NonFic/Sci, 2/NonFic/Sci/Phys). Since I'm using DIH to import my data from a DB, do I create a TemplateTransformer to produce the indexed data? Do I have to do something special within schema.xml and/or solrconfig.xml? Once I figure out the correct config setup, I assume it's simply a matter of creating the correct solr query like he describes in the video? Thanks, kmf -- View this message in context: http://lucene.472066.n3.nabble.com/hierarchical-faceting-SOLR-792-confused-on-config-tp2556394p2556394.html Sent from the Solr - User mailing list archive at Nabble.com.
Re: hierarchical faceting, SOLR-792 - confused on config
(11/02/23 8:26), kmf wrote: I'm using solr 4.0 and trying to implement a hierarchical faceting example. The example I'm trying to implement is taken from the webcast Mastering the Power of Faceted Search. (http://www.lucidimagination.com/solutions/webcasts/faceting) Around minute 30, Chris Hostetter gives a very nice tips tricks example he described as Taxonomy facets. Where I'm confused is how to get the data indexed/organized into the taxonomy facets (0/NonFic, 1/NonFic/Law, 0/NonFic, 1/NonFic/Sci, 0/NonFic, 1/NonFic/Hist, 1/NonFic/Sci, 2/NonFic/Sci/Phys). Since I'm using DIH to import my data from a DB, do I create a TemplateTransformer to produce the indexed data? Do I have to do something special within schema.xml and/or solrconfig.xml? Once I figure out the correct config setup, I assume it's simply a matter of creating the correct solr query like he describes in the video? Thanks, kmf kmf, disclaimer: I've never seen the webcast yet. First, SOLR-792 is not for hierarchical faceting. Please see SOLR-64. Second, please take a look at PathHierarchyTokenizer in trunk and 3x. It cannot output the depth factor (0/, 1/, ...), though. Hmm, does everyone think that it has to be better if it outputs the depth factors to type or payload or somewhere else? Koji -- http://www.rondhuit.com/en/
Re: SOLR-792 (hierarchical faceting) issue when only 1 document should be present in the pivot
I have had the same problem .. my facet pivots was returning results something like Cat-A (3) Item X Item Y only 2 items instead of 3 or even Cat-B (2) no items zero items instead of 2 so the parent level count didnt matched with the returned child pivots .. but once I set the facet.pivot.mincount = 0 .. then it works fine .. is this a bug or the desired behavior .. On Wed, Nov 24, 2010 at 7:49 AM, Nicolas Peeters nicoli...@gmail.comwrote: Hi Solr-Users, I realized that I can get the behaviour that I expect if I put facet.pivot.mincount to 0. However, I'm still puzzled why this needs to be 0 and not 1. There's one occurence for this document, isn't it? With this value to 1, the print out of the pivot looks like this (where you clearly see (1) for Value_that_can't_be_matched): PIVOT: level1_loc_s,level2_loc_s,level3_loc_s level1_loc_s=Greater London (8) level2_loc_s=London (5) level3_loc_s=Mayfair (3) level3_loc_s=Hammersmith (2) level2_loc_s=Greenwich (3) level3_loc_s=Greenwich Centre (2) level3_loc_s=Value_that_cant_be_matched (1) level1_loc_s=Groot Amsterdam (5) level2_loc_s=Amsterdam (3) level3_loc_s=Jordaan (2) level3_loc_s=Centrum (1) level2_loc_s=Amstelveen (2) level3_loc_s=Centrum (2) Any expert advice on why this is the case is more than welcome! Best regards, Nicolas On Wed, Nov 24, 2010 at 2:27 PM, Nicolas Peeters nicoli...@gmail.com wrote: Hi Solr Community, I've been experimenting with Solr 4.0 (trunk) in order to test the SOLR-792 feature. I have written a test that shows what I'm trying to ask. Basically, I'm creating a hierarchy of the area/city/neighbourhood. The problem that I see is that for documents that have only 1 item in a particular hierarchy (e.g. Greater London/Greenwich/Centre (which I've called Value_that_cant_be_matched in this example...)), these are not found by the pivot facet. If I add a second one, then it works. I'm puzzled why this is the case. This is the result of the Sytem.out that prints out the pivot facet fields hierarchy (see line 86) PIVOT: level1_loc_s,level2_loc_s,level3_loc_s level1_loc_s=Greater London (8) level2_loc_s=London (5) level3_loc_s=Mayfair (3) level3_loc_s=Hammersmith (2) level2_loc_s=Greenwich (3) level3_loc_s=Greenwich Centre (2) //-- why isn't there a level3_loc_s=Value_that_cant_be_matched (1) here? level1_loc_s=Groot Amsterdam (5) level2_loc_s=Amsterdam (3) level3_loc_s=Jordaan (2) level2_loc_s=Amstelveen (2) level3_loc_s=Centrum (2) How can I make sure that Solr would find in the tree the single document when I facet on this location hierarchy? Thank you very much for your help. Nicolas import java.io.IOException; import java.net.MalformedURLException; import java.util.ArrayList; import java.util.List; import java.util.Map; import org.apache.solr.client.solrj.SolrQuery; import org.apache.solr.client.solrj.SolrServerException; import org.apache.solr.client.solrj.impl.CommonsHttpSolrServer; import org.apache.solr.client.solrj.response.PivotField; import org.apache.solr.client.solrj.response.QueryResponse; import org.apache.solr.common.SolrInputDocument; import org.apache.solr.common.util.NamedList; import org.junit.Assert; import org.junit.Before; import org.junit.Test; /** * This is a test for hiearchical faceting based on SOLR-792 (I basically just checkout the trunk of Solr-4.0). * * Unit test that shows the particular behaviour that I'm experiencing. * I would have expected that the doc (see line 95) with as level3_loc_s Value_that_cant_be_matched would appear in the pivot. It seems that you actually need at least 2! * * @author npeeters */ public class HierarchicalPivotTest { CommonsHttpSolrServer server; @Before public void setup() throws MalformedURLException { // the instance can be reused this.server = new CommonsHttpSolrServer( http://localhost:8983/solr;); this.server.setSoTimeout(500); // socket read timeout this.server.setConnectionTimeout(100); this.server.setDefaultMaxConnectionsPerHost(100); this.server.setMaxTotalConnections(100); this.server.setFollowRedirects(false); // defaults to false // allowCompression defaults to false. } protected ListSolrInputDocument createHierarchicalOrgData() { int id = 1; ListSolrInputDocument docs = new ArrayListSolrInputDocument(); docs.add(makeTestDoc(id, id++, name, Organization + id, level1_loc_s, Groot Amsterdam, level2_loc_s, Amsterdam, level3_loc_s, Centrum)); docs.add(makeTestDoc(id, id++, name, Organization + id, level1_loc_s, Groot Amsterdam, level2_loc_s, Amsterdam, level3_loc_s, Jordaan)); docs.add(makeTestDoc(id, id++, name,
SOLR-792 (hierarchical faceting) issue when only 1 document should be present in the pivot
Hi Solr Community, I've been experimenting with Solr 4.0 (trunk) in order to test the SOLR-792 feature. I have written a test that shows what I'm trying to ask. Basically, I'm creating a hierarchy of the area/city/neighbourhood. The problem that I see is that for documents that have only 1 item in a particular hierarchy (e.g. Greater London/Greenwich/Centre (which I've called Value_that_cant_be_matched in this example...)), these are not found by the pivot facet. If I add a second one, then it works. I'm puzzled why this is the case. This is the result of the Sytem.out that prints out the pivot facet fields hierarchy (see line 86) PIVOT: level1_loc_s,level2_loc_s,level3_loc_s level1_loc_s=Greater London (8) level2_loc_s=London (5) level3_loc_s=Mayfair (3) level3_loc_s=Hammersmith (2) level2_loc_s=Greenwich (3) level3_loc_s=Greenwich Centre (2) //-- why isn't there a level3_loc_s=Value_that_cant_be_matched (1) here? level1_loc_s=Groot Amsterdam (5) level2_loc_s=Amsterdam (3) level3_loc_s=Jordaan (2) level2_loc_s=Amstelveen (2) level3_loc_s=Centrum (2) How can I make sure that Solr would find in the tree the single document when I facet on this location hierarchy? Thank you very much for your help. Nicolas import java.io.IOException; import java.net.MalformedURLException; import java.util.ArrayList; import java.util.List; import java.util.Map; import org.apache.solr.client.solrj.SolrQuery; import org.apache.solr.client.solrj.SolrServerException; import org.apache.solr.client.solrj.impl.CommonsHttpSolrServer; import org.apache.solr.client.solrj.response.PivotField; import org.apache.solr.client.solrj.response.QueryResponse; import org.apache.solr.common.SolrInputDocument; import org.apache.solr.common.util.NamedList; import org.junit.Assert; import org.junit.Before; import org.junit.Test; /** * This is a test for hiearchical faceting based on SOLR-792 (I basically just checkout the trunk of Solr-4.0). * * Unit test that shows the particular behaviour that I'm experiencing. * I would have expected that the doc (see line 95) with as level3_loc_s Value_that_cant_be_matched would appear in the pivot. It seems that you actually need at least 2! * * @author npeeters */ public class HierarchicalPivotTest { CommonsHttpSolrServer server; @Before public void setup() throws MalformedURLException { // the instance can be reused this.server = new CommonsHttpSolrServer(http://localhost:8983/solr ); this.server.setSoTimeout(500); // socket read timeout this.server.setConnectionTimeout(100); this.server.setDefaultMaxConnectionsPerHost(100); this.server.setMaxTotalConnections(100); this.server.setFollowRedirects(false); // defaults to false // allowCompression defaults to false. } protected ListSolrInputDocument createHierarchicalOrgData() { int id = 1; ListSolrInputDocument docs = new ArrayListSolrInputDocument(); docs.add(makeTestDoc(id, id++, name, Organization + id, level1_loc_s, Groot Amsterdam, level2_loc_s, Amsterdam, level3_loc_s, Centrum)); docs.add(makeTestDoc(id, id++, name, Organization + id, level1_loc_s, Groot Amsterdam, level2_loc_s, Amsterdam, level3_loc_s, Jordaan)); docs.add(makeTestDoc(id, id++, name, Organization + id, level1_loc_s, Groot Amsterdam, level2_loc_s, Amsterdam, level3_loc_s, Jordaan)); docs.add(makeTestDoc(id, id++, name, Organization + id, level1_loc_s, Groot Amsterdam, level2_loc_s, Amstelveen, level3_loc_s, Centrum)); docs.add(makeTestDoc(id, id++, name, Organization + id, level1_loc_s, Groot Amsterdam, level2_loc_s, Amstelveen, level3_loc_s, Centrum)); docs.add(makeTestDoc(id, id++, name, Organization + id, level1_loc_s, Greater London, level2_loc_s, London, level3_loc_s, Hammersmith)); docs.add(makeTestDoc(id, id++, name, Organization + id, level1_loc_s, Greater London, level2_loc_s, London, level3_loc_s, Hammersmith)); docs.add(makeTestDoc(id, id++, name, Organization + id, level1_loc_s, Greater London, level2_loc_s, London, level3_loc_s, Mayfair)); docs.add(makeTestDoc(id, id++, name, Organization + id, level1_loc_s, Greater London, level2_loc_s, London, level3_loc_s, Mayfair)); docs.add(makeTestDoc(id, id++, name, Organization + id, level1_loc_s, Greater London, level2_loc_s, London, level3_loc_s, Mayfair)); docs.add(makeTestDoc(id, id++, name, Organization + id, level1_loc_s, Greater London, level2_loc_s, Greenwich, level3_loc_s, Value_that_cant_be_matched)); docs.add(makeTestDoc(id, id++, name, Organization + id, level1_loc_s, Greater London, level2_loc_s, Greenwich, level3_loc_s, Greenwich Centre)); docs.add(makeTestDoc(id, id++, name, Organization + id, level1_loc_s, Greater London, level2_loc_s, Greenwich, level3_loc_s, Greenwich Centre)); return docs; } @Test
Re: SOLR-792 (hierarchical faceting) issue when only 1 document should be present in the pivot
Hi Solr-Users, I realized that I can get the behaviour that I expect if I put facet.pivot.mincount to 0. However, I'm still puzzled why this needs to be 0 and not 1. There's one occurence for this document, isn't it? With this value to 1, the print out of the pivot looks like this (where you clearly see (1) for Value_that_can't_be_matched): PIVOT: level1_loc_s,level2_loc_s,level3_loc_s level1_loc_s=Greater London (8) level2_loc_s=London (5) level3_loc_s=Mayfair (3) level3_loc_s=Hammersmith (2) level2_loc_s=Greenwich (3) level3_loc_s=Greenwich Centre (2) level3_loc_s=Value_that_cant_be_matched (1) level1_loc_s=Groot Amsterdam (5) level2_loc_s=Amsterdam (3) level3_loc_s=Jordaan (2) level3_loc_s=Centrum (1) level2_loc_s=Amstelveen (2) level3_loc_s=Centrum (2) Any expert advice on why this is the case is more than welcome! Best regards, Nicolas On Wed, Nov 24, 2010 at 2:27 PM, Nicolas Peeters nicoli...@gmail.comwrote: Hi Solr Community, I've been experimenting with Solr 4.0 (trunk) in order to test the SOLR-792 feature. I have written a test that shows what I'm trying to ask. Basically, I'm creating a hierarchy of the area/city/neighbourhood. The problem that I see is that for documents that have only 1 item in a particular hierarchy (e.g. Greater London/Greenwich/Centre (which I've called Value_that_cant_be_matched in this example...)), these are not found by the pivot facet. If I add a second one, then it works. I'm puzzled why this is the case. This is the result of the Sytem.out that prints out the pivot facet fields hierarchy (see line 86) PIVOT: level1_loc_s,level2_loc_s,level3_loc_s level1_loc_s=Greater London (8) level2_loc_s=London (5) level3_loc_s=Mayfair (3) level3_loc_s=Hammersmith (2) level2_loc_s=Greenwich (3) level3_loc_s=Greenwich Centre (2) //-- why isn't there a level3_loc_s=Value_that_cant_be_matched (1) here? level1_loc_s=Groot Amsterdam (5) level2_loc_s=Amsterdam (3) level3_loc_s=Jordaan (2) level2_loc_s=Amstelveen (2) level3_loc_s=Centrum (2) How can I make sure that Solr would find in the tree the single document when I facet on this location hierarchy? Thank you very much for your help. Nicolas import java.io.IOException; import java.net.MalformedURLException; import java.util.ArrayList; import java.util.List; import java.util.Map; import org.apache.solr.client.solrj.SolrQuery; import org.apache.solr.client.solrj.SolrServerException; import org.apache.solr.client.solrj.impl.CommonsHttpSolrServer; import org.apache.solr.client.solrj.response.PivotField; import org.apache.solr.client.solrj.response.QueryResponse; import org.apache.solr.common.SolrInputDocument; import org.apache.solr.common.util.NamedList; import org.junit.Assert; import org.junit.Before; import org.junit.Test; /** * This is a test for hiearchical faceting based on SOLR-792 (I basically just checkout the trunk of Solr-4.0). * * Unit test that shows the particular behaviour that I'm experiencing. * I would have expected that the doc (see line 95) with as level3_loc_s Value_that_cant_be_matched would appear in the pivot. It seems that you actually need at least 2! * * @author npeeters */ public class HierarchicalPivotTest { CommonsHttpSolrServer server; @Before public void setup() throws MalformedURLException { // the instance can be reused this.server = new CommonsHttpSolrServer( http://localhost:8983/solr;); this.server.setSoTimeout(500); // socket read timeout this.server.setConnectionTimeout(100); this.server.setDefaultMaxConnectionsPerHost(100); this.server.setMaxTotalConnections(100); this.server.setFollowRedirects(false); // defaults to false // allowCompression defaults to false. } protected ListSolrInputDocument createHierarchicalOrgData() { int id = 1; ListSolrInputDocument docs = new ArrayListSolrInputDocument(); docs.add(makeTestDoc(id, id++, name, Organization + id, level1_loc_s, Groot Amsterdam, level2_loc_s, Amsterdam, level3_loc_s, Centrum)); docs.add(makeTestDoc(id, id++, name, Organization + id, level1_loc_s, Groot Amsterdam, level2_loc_s, Amsterdam, level3_loc_s, Jordaan)); docs.add(makeTestDoc(id, id++, name, Organization + id, level1_loc_s, Groot Amsterdam, level2_loc_s, Amsterdam, level3_loc_s, Jordaan)); docs.add(makeTestDoc(id, id++, name, Organization + id, level1_loc_s, Groot Amsterdam, level2_loc_s, Amstelveen, level3_loc_s, Centrum)); docs.add(makeTestDoc(id, id++, name, Organization + id, level1_loc_s, Groot Amsterdam, level2_loc_s, Amstelveen, level3_loc_s, Centrum)); docs.add(makeTestDoc(id, id++, name, Organization + id, level1_loc_s, Greater London, level2_loc_s, London, level3_loc_s, Hammersmith));
Re: Hierarchical faceting
Thank you for your answer. I sure will implement something in that direction. But couldn't multiple tokens be used instead of multiple values? fieldType name=hier class=solr.TextField analyzer type=index // some tokenizer and filters that generates 0//Europe, 1//Europe//Norway, 2//Europe//Norway//Oslo /analyzer /fieldType field name=country_facet type=hier indexed=true stored=true/ Wouldn't that work in just the same way? Or is it some difference between multiple tokens and multiple values that I'm missing? -- Regards, Mats Bolstad On Fri, Aug 13, 2010 at 2:21 AM, Jayendra Patil jayendra.patil@gmail.com wrote: We were able to get the hierarchy faceting working with a work around approach. e.g. if you have Europe//Norway//Oslo as an entry 1. Create a new multivalued field with string type field name=country_facet type=string indexed=true stored=true multiValued=true/ 2. Index the field for Europe//Norway//Oslo with values 0//Europe 1//Europe//Norway 2//Europe//Norway//Oslo 3. The Facet can now be used in the Queries :- 1st Level - Would return all entries @ 1st level e.g. 0//USA, 0//Europe fq= f.country_facet.facet.prefix=0// facet.field=country_facet 2nd Level - Would return all entries @ second level in Europe 1//Europe//Norway, 1//Europe//Sweden fq=country_facet:0//Europe f.country_facet.facet.prefix=1//Europe facet.field=country_facet 3rd Level - Would return 1//Europe//Norway entries fq=country_facet:1//Europe//Norway f.country_facet.facet.prefix=2//Europe//Norway facet.field=country_facet Increment the facet.prefix by 1 so that you limit the facet results to to that prefix. Also works for any depth. Regards, Jayendra On Thu, Aug 12, 2010 at 6:01 PM, Mats Bolstad mat...@stud.ntnu.no wrote: Hey all, I am doing a search on hierarchical data, and I have a hard time getting my head around the following problem. I want a result as follows, in one single query only: USA (3) California (2) Arizona (1) Europe (4) Norway (3) Oslo (3) Sweden (1) How it looks in the XML/JSON response is not really important, this is more a presentation issue. I guess I could store the values USA, USA/California, Europe/Norway/Oslo as strings for each document, and do some JavaScript-ing to show the hierarchies appropriately. When a specific item in the facet is selected, for example Norway, Solr could be queries with a filter query on Europe/Norway*? Do anyone have some experiences they could please share with me? I have tried out SOLR-64, and it gives me the results I look for. However, I do not have the opportunity to use a patch in the production environment ... -- Thanks, Mats Bolstad
Re: Hierarchical faceting
Check out project Bobo: http://sna-projects.com/bobo/ A lucene based faceted search library. Now with solr plugin: http://snaprojects.jira.com/wiki/display/BOBO/Bobo+Solr+Plugin -John On Fri, Aug 13, 2010 at 8:56 PM, Jayendra Patil jayendra.patil@gmail.com wrote: Multiple values are probably same as Multiple Tokens with a high position increment gap. Would still prefer to go with the multivalued field approach, as it is inbuilt and easier to get back the individual facets with the count in the response. Regards, Jayendra On Fri, Aug 13, 2010 at 7:57 AM, Mats Bolstad mat...@stud.ntnu.no wrote: Thank you for your answer. I sure will implement something in that direction. But couldn't multiple tokens be used instead of multiple values? fieldType name=hier class=solr.TextField analyzer type=index // some tokenizer and filters that generates 0//Europe, 1//Europe//Norway, 2//Europe//Norway//Oslo /analyzer /fieldType field name=country_facet type=hier indexed=true stored=true/ Wouldn't that work in just the same way? Or is it some difference between multiple tokens and multiple values that I'm missing? -- Regards, Mats Bolstad On Fri, Aug 13, 2010 at 2:21 AM, Jayendra Patil jayendra.patil@gmail.com wrote: We were able to get the hierarchy faceting working with a work around approach. e.g. if you have Europe//Norway//Oslo as an entry 1. Create a new multivalued field with string type field name=country_facet type=string indexed=true stored=true multiValued=true/ 2. Index the field for Europe//Norway//Oslo with values 0//Europe 1//Europe//Norway 2//Europe//Norway//Oslo 3. The Facet can now be used in the Queries :- 1st Level - Would return all entries @ 1st level e.g. 0//USA, 0//Europe fq= f.country_facet.facet.prefix=0// facet.field=country_facet 2nd Level - Would return all entries @ second level in Europe 1//Europe//Norway, 1//Europe//Sweden fq=country_facet:0//Europe f.country_facet.facet.prefix=1//Europe facet.field=country_facet 3rd Level - Would return 1//Europe//Norway entries fq=country_facet:1//Europe//Norway f.country_facet.facet.prefix=2//Europe//Norway facet.field=country_facet Increment the facet.prefix by 1 so that you limit the facet results to to that prefix. Also works for any depth. Regards, Jayendra On Thu, Aug 12, 2010 at 6:01 PM, Mats Bolstad mat...@stud.ntnu.no wrote: Hey all, I am doing a search on hierarchical data, and I have a hard time getting my head around the following problem. I want a result as follows, in one single query only: USA (3) California (2) Arizona (1) Europe (4) Norway (3) Oslo (3) Sweden (1) How it looks in the XML/JSON response is not really important, this is more a presentation issue. I guess I could store the values USA, USA/California, Europe/Norway/Oslo as strings for each document, and do some JavaScript-ing to show the hierarchies appropriately. When a specific item in the facet is selected, for example Norway, Solr could be queries with a filter query on Europe/Norway*? Do anyone have some experiences they could please share with me? I have tried out SOLR-64, and it gives me the results I look for. However, I do not have the opportunity to use a patch in the production environment ... -- Thanks, Mats Bolstad
Hierarchical faceting
Hey all, I am doing a search on hierarchical data, and I have a hard time getting my head around the following problem. I want a result as follows, in one single query only: USA (3) California (2) Arizona (1) Europe (4) Norway (3) Oslo (3) Sweden (1) How it looks in the XML/JSON response is not really important, this is more a presentation issue. I guess I could store the values USA, USA/California, Europe/Norway/Oslo as strings for each document, and do some JavaScript-ing to show the hierarchies appropriately. When a specific item in the facet is selected, for example Norway, Solr could be queries with a filter query on Europe/Norway*? Do anyone have some experiences they could please share with me? I have tried out SOLR-64, and it gives me the results I look for. However, I do not have the opportunity to use a patch in the production environment ... -- Thanks, Mats Bolstad
Re: Hierarchical faceting
We were able to get the hierarchy faceting working with a work around approach. e.g. if you have Europe//Norway//Oslo as an entry 1. Create a new multivalued field with string type field name=country_facet type=string indexed=true stored=true multiValued=true/ 2. Index the field for Europe//Norway//Oslo with values 0//Europe 1//Europe//Norway 2//Europe//Norway//Oslo 3. The Facet can now be used in the Queries :- 1st Level - Would return all entries @ 1st level e.g. 0//USA, 0//Europe fq= f.country_facet.facet.prefix=0// facet.field=country_facet 2nd Level - Would return all entries @ second level in Europe 1//Europe//Norway, 1//Europe//Sweden fq=country_facet:0//Europe f.country_facet.facet.prefix=1//Europe facet.field=country_facet 3rd Level - Would return 1//Europe//Norway entries fq=country_facet:1//Europe//Norway f.country_facet.facet.prefix=2//Europe//Norway facet.field=country_facet Increment the facet.prefix by 1 so that you limit the facet results to to that prefix. Also works for any depth. Regards, Jayendra On Thu, Aug 12, 2010 at 6:01 PM, Mats Bolstad mat...@stud.ntnu.no wrote: Hey all, I am doing a search on hierarchical data, and I have a hard time getting my head around the following problem. I want a result as follows, in one single query only: USA (3) California (2) Arizona (1) Europe (4) Norway (3) Oslo (3) Sweden (1) How it looks in the XML/JSON response is not really important, this is more a presentation issue. I guess I could store the values USA, USA/California, Europe/Norway/Oslo as strings for each document, and do some JavaScript-ing to show the hierarchies appropriately. When a specific item in the facet is selected, for example Norway, Solr could be queries with a filter query on Europe/Norway*? Do anyone have some experiences they could please share with me? I have tried out SOLR-64, and it gives me the results I look for. However, I do not have the opportunity to use a patch in the production environment ... -- Thanks, Mats Bolstad
Re: wildcard search and hierarchical faceting
There are some approaches outlined here that might be of interest: http://wiki.apache.org/solr/HierarchicalFaceting On Jan 24, 2010, at 2:54 AM, Andy wrote: I'd like to provide a hierarchical faceting functionality. An example would be location drill down such as USA - New York - New York City - SoHo The number of levels can be arbitrary. One way to handle this could be to use a special character as separator, store values such as USA|New York|New York City|SoHo and use wildcard search. So if USA has been selected, the fq would be USA* I read somewhere that when using wildcard search, no stemming or tokenization will be performed. So USA will not match 'usa. Is there any way to work around that? Or would you recommend a different way to handle hierarchical faceting?
wildcard search and hierarchical faceting
I'd like to provide a hierarchical faceting functionality. An example would be location drill down such as USA - New York - New York City - SoHo The number of levels can be arbitrary. One way to handle this could be to use a special character as separator, store values such as USA|New York|New York City|SoHo and use wildcard search. So if USA has been selected, the fq would be USA* I read somewhere that when using wildcard search, no stemming or tokenization will be performed. So USA will not match 'usa. Is there any way to work around that? Or would you recommend a different way to handle hierarchical faceting?
Re: hierarchical faceting discussion
I was particularly surprised by the SOLR-64 numbers. What makes it's response so huge (and thus slow) to return the entire tree of facet counts? Erik On Jul 19, 2009, at 5:35 PM, Erik Hatcher wrote: I've posted the details of some experiments I just did comparing/ contrasting two approaches for faceting on documents within hierarchical structures: http://wiki.apache.org/solr/HierarchicalFaceting I'm sure I'm only scratching the service with the currently implementations of both SOLR-64 and SOLR-792. Alternative approaches are welcome! As I said on the wiki page, there won't be any single method that works in all cases - it will depend on how the hierarchical counts are needed - as an entire tree? (not likely in large taxonomic cases!) How are level pruned counts needed? Implementation-wise, seems like payloads could be be useful for some use cases. What are the use cases? What types and sizes of hierarchies are folks dealing with out there in the real world? Erik
Re: Hierarchical Faceting
: Suppose, I have 3 categories like politics, science and sports. In the : schema, I am defining a field type called 'Category'. I don't have a sub : category field type (and don't want to have one). Now, Cricket and : Football are some categories which can be considered to be under sports. : When I search for something and if it is present in the 'sports' : category, then it should show me the facets of cricket and football too. : My question is: Do I need to specify cricket, football also as : categories or sub categories of sports (for which I don't want to make a : separate field)? And if I make these as categories only, then how will I : achieve the drilling down of the data to cricket or football. there are lots of solutions to problems like this, but picking the best one tends to depend on what exactly you wnat the search experience to be like. based on your description of your problem, an approach where you index all of the ancestor breadcrumbs for hte categories a document is in along with the depth of each ancestor in the tree, and then facet on those with a prefix restriction would probably work well. ie: docA: cat = sport/cricket docB: cat = sport/shateboarding docC: cat = sport/skateboarding/vert docD: cat = sport/skateboarding/street docE: cat = finance tokens indexed docA: cat = 0/sport, 1/sport/cricket docB: cat = 0/sport, 1/sport/shateboarding docC: cat = 0/sport, 1/sport/skateboarding, 2/sport/skateboarding/vert docD: cat = 0/sport, 1/sport/skateboarding, 2/sport/skateboarding/street docE: cat = 0/finance so now your first request you use something like... q=foobarfacet=truefacet.field=catf.cat.facet.prefix=0/ ..and you'll get facet counds for sport and finance. if they pick sport your next request is something like... q=foobarfq=cat:0/sportfacet=truefacet.field=catf.cat.facet.prefix=1/sport/ ...and you'll get facet counds for all the subcats of sport ... etc. -Hoss
RE: Hierarchical Faceting
Thanks Hoss, I was mainly looking for an explanation of such an answer only coz in the forum there were such replies posted for Hierarchical faceting. I'll try out the method. Thanks. Sachit -Original Message- From: Chris Hostetter [mailto:[EMAIL PROTECTED] Sent: Sunday, October 26, 2008 11:43 PM To: solr-user@lucene.apache.org Subject: Re: Hierarchical Faceting : Suppose, I have 3 categories like politics, science and sports. In the : schema, I am defining a field type called 'Category'. I don't have a sub : category field type (and don't want to have one). Now, Cricket and : Football are some categories which can be considered to be under sports. : When I search for something and if it is present in the 'sports' : category, then it should show me the facets of cricket and football too. : My question is: Do I need to specify cricket, football also as : categories or sub categories of sports (for which I don't want to make a : separate field)? And if I make these as categories only, then how will I : achieve the drilling down of the data to cricket or football. there are lots of solutions to problems like this, but picking the best one tends to depend on what exactly you wnat the search experience to be like. based on your description of your problem, an approach where you index all of the ancestor breadcrumbs for hte categories a document is in along with the depth of each ancestor in the tree, and then facet on those with a prefix restriction would probably work well. ie: docA: cat = sport/cricket docB: cat = sport/shateboarding docC: cat = sport/skateboarding/vert docD: cat = sport/skateboarding/street docE: cat = finance tokens indexed docA: cat = 0/sport, 1/sport/cricket docB: cat = 0/sport, 1/sport/shateboarding docC: cat = 0/sport, 1/sport/skateboarding, 2/sport/skateboarding/vert docD: cat = 0/sport, 1/sport/skateboarding, 2/sport/skateboarding/street docE: cat = 0/finance so now your first request you use something like... q=foobarfacet=truefacet.field=catf.cat.facet.prefix=0/ ..and you'll get facet counds for sport and finance. if they pick sport your next request is something like... q=foobarfq=cat:0/sportfacet=truefacet.field=catf.cat.facet.prefix=1/sport/ ...and you'll get facet counds for all the subcats of sport ... etc. -Hoss This message (including attachment if any) is confidential and may be privileged. If you have received this message by mistake please notify the sender by return e-mail and delete this message from your system. Any unauthorized use or dissemination of this message in whole or in part is strictly prohibited. E-mail may contain viruses. Before opening attachments please check them for viruses and defects. While MindTree Limited (MindTree) has put in place checks to minimize the risks, MindTree will not be responsible for any viruses or defects or any forwarded attachments emanating either from within MindTree or outside. Please note that e-mails are susceptible to change and MindTree shall not be liable for any improper, untimely or incomplete transmission. MindTree reserves the right to monitor and review the content of all messages sent to or from MindTree e-mail address. Messages sent to or from this e-mail address may be stored on the MindTree e-mail system or else where.
Re: Hierarchical Faceting
On Tue, Oct 21, 2008 at 3:59 PM, Sachit P. Menon [EMAIL PROTECTED] wrote: Hi, I have gone through the archive in search of Hierarchical Faceting but was not clear as what should I exactly do to achieve that. Suppose, I have 3 categories like politics, science and sports. In the schema, I am defining a field type called 'Category'. I don't have a sub category field type (and don't want to have one). Now, Cricket and Football are some categories which can be considered to be under sports. When I search for something and if it is present in the 'sports' category, then it should show me the facets of cricket and football too. My question is: Do I need to specify cricket, football also as categories or sub categories of sports (for which I don't want to make a separate field)? And if I make these as categories only, then how will I achieve the drilling down of the data to cricket or football. Hi Sachit! I've had the same problem with a search for whine. The origin of whine can consist of up to three hierarchical values country (e.g. France), region (e.g. Bordeaux) and sub-region (e.g. St. Emilion). I have three facet fields country, region, sub-region for that. But I only display the region facet under the following conditions: - the user has selected a specific country, e.g. France, as filter - or only one country is left (due to other filtering or fulltext search) Don't know if this suits you. Just the way I handle it. It's not yet publicly available though. Marian
Hierarchical Faceting
Hi, I have gone through the archive in search of Hierarchical Faceting but was not clear as what should I exactly do to achieve that. Suppose, I have 3 categories like politics, science and sports. In the schema, I am defining a field type called 'Category'. I don't have a sub category field type (and don't want to have one). Now, Cricket and Football are some categories which can be considered to be under sports. When I search for something and if it is present in the 'sports' category, then it should show me the facets of cricket and football too. My question is: Do I need to specify cricket, football also as categories or sub categories of sports (for which I don't want to make a separate field)? And if I make these as categories only, then how will I achieve the drilling down of the data to cricket or football. Thanks and Regards Sachit P. Menon| Programmer Analyst| MindTree Ltd. |West Campus, Phase-1, Global Village, RVCE Post, Mysore Road, Bangalore-560 059, INDIA |Voice +91 80 26264000 |Extn 64907|Fax +91 80 26264100 | Mob : +91 9986747356|www.mindtree.comhttps://indiamail.mindtree.com/exchweb/bin/redir.asp?URL=http://www.mindtree.com/ | This message (including attachment if any) is confidential and may be privileged. If you have received this message by mistake please notify the sender by return e-mail and delete this message from your system. Any unauthorized use or dissemination of this message in whole or in part is strictly prohibited. E-mail may contain viruses. Before opening attachments please check them for viruses and defects. While MindTree Limited (MindTree) has put in place checks to minimize the risks, MindTree will not be responsible for any viruses or defects or any forwarded attachments emanating either from within MindTree or outside. Please note that e-mails are susceptible to change and MindTree shall not be liable for any improper, untimely or incomplete transmission. MindTree reserves the right to monitor and review the content of all messages sent to or from MindTree e-mail address. Messages sent to or from this e-mail address may be stored on the MindTree e-mail system or else where.