Date: 2004-04-04T19:59:17 Editor: StephaneVaucher <[EMAIL PROTECTED]> Wiki: Jakarta Lucene Wiki Page: HierarchicalFields URL: http://wiki.apache.org/jakarta-lucene/HierarchicalFields
no comment New Page: ##language:en #pragma section-numbers off = Using Hierarchical Fields = == Original question from == URL: [http://issues.apache.org/eyebrowse/[EMAIL PROTECTED]&msgNo=7507] Each document I index has an array of categories which looks like the following example.... '''/Science/Medicine/Serology/blood gas''' [[BR]] '''/Biology/Fluids/Blood/''' etc. Anyway, there's a couple things I'm trying to deal with. 1- The fact that we have an undefined array size. I can't just shove these into a single field. I could explode them into multiple fields on the fly like category_1, category_2. etc. etc 2- The fact that a search will need to be performed like '''"category:/Science/Medicine/*"''' would need to return all items within that category. == Answer == URL: [http://issues.apache.org/eyebrowse/ReadMsg?listId=30&msgNo=7512], Erik Hatcher doc.add(Field.Keyword("category", category1));[[BR]] doc.add(Field.Keyword("category", category2));[[BR]] doc.add(Field.Keyword("category", category/subcategory1));[[BR]] doc.add(Field.Keyword("category", category/subcategory2)); Note: Be careful of the analyzer you use. == Alternate answer == URL: [http://issues.apache.org/eyebrowse/[EMAIL PROTECTED]&msgNo=7508], Tate Avery Could you put them all into a tab-delimited string and store that as a single field, then use a Tab''''''Tokenizer on the field to search? --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]