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 > >> > > >