You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by maustin75 <ma...@gmail.com> on 2006/05/21 04:49:56 UTC

facet id values for indexed documents

I have a database of products to search.  I plan to have a design with 
categories/facet groups/facets.  Similar to this:
<categories>
     <category id="1" label="TopLevel" query="+cat:1">
         <category id="2" label="SecondLevel" query="+cat:2">
             <category id="3" label="ThirdLevel" query="+cat:3">
                <group id="1" label="Price">
                      <facet id="1" label="Under $20" query="+price:[0 TO 
20]" />
                      <facet id="2" label="$21 - $40" query="+price:[21 TO 
40]" />
                      <facet id="3" label="$41 - $60" query="+price:[41 TO 
60]" />
                      <facet id="4" label="Over $60" query="+price:61 TO 
9999]" />
                </group>
                <group id="2" label="Manufacturer">
                        <facet id="5" label="Sony" query="+mfg:sony" />
                </group>
            </category>.......

.......

After looking over the fields in the default solr schema, I am having 
trouble deciding where to put my facet id values.  Seems like I should add a 
field called tags, or facets, or something similar.  Also, I'm adding a 
description field.  I guess I'm trying to verify that there is not a better 
solution or field value that I should be using to keep my product 
descriptions and tags/facet values?  Because these two fields are probably 
common, I was wondered why it wasn't in the default schema?

Thanks,
Mike 


Re: facet id values for indexed documents

Posted by Chris Hostetter <ho...@fucit.org>.
: After looking over the fields in the default solr schema, I am having
: trouble deciding where to put my facet id values.  Seems like I should add a
: field called tags, or facets, or something similar.  Also, I'm adding a
: description field.  I guess I'm trying to verify that there is not a better
: solution or field value that I should be using to keep my product
: descriptions and tags/facet values?  Because these two fields are probably
: common, I was wondered why it wasn't in the default schema?

First off, there is no default solr schema ... just a sample schema
provided with the example to give you an idea of all the different types
of things that are possible in a Solr schema -- by all means you should
make your own schema to fit the needs of your index.

Second: there's really no need to put the information about what facets
you have into documents in your index -- you certainly could do that (In
my case, in addition to having one document per product, i have one
"metadata document" per category which contains stored fields with
structured information about what facets i want) but you could just as
easily store that information externally in configuration files -- either
directly in the solrconfig.xml so that it's passed to your request
handlers init()  method, or in a file whose name is specified in the
solrconfig.xml.

once you've done that you can parse the facet information and store it in
memory in any datastructure you want ... based on your sample XML, I'm
guessing you'd have a structure that ultimately contained a lot of records
with numeric identifiers pointing at label/Query pairs.  When your handler
recieves a request, it can walk your datastructure looking at the IDs
specified in the request to figure out which Queries to execute to filter
the main result set, and which queries to execute to get a facet count ...
the filterCache should make sure that all of the individual DocSets are
cached (and warmed when the index changes)

Your example XML file looks like upi are persuing a very generic,
reusable, general purpose config format for faceted searching, along the
lines of some brainstorming that was done a while back...

http://www.nabble.com/metadata+about+result+sets--t1243321.html

please keep the rest of us in the loop on your progress ... even if your
project isn't something you would able to contribute back to Apache, any
insights you have while working on generic faceted searching would be
valuable to others.


-Hoss