Indexing lists (arrays) of values.

35 views
Skip to first unread message

Simon Weare

unread,
Jul 7, 2011, 7:14:30 AM7/7/11
to inde...@googlegroups.com
Hi,

I'm after some pointers (or examples) of the best way to go about adding lists of values (arrays) to an index. The 'categories' map that can be supplied with the index request requires a 1:1 mapping of category name to category value, but what if I wanted to add a list of items to an index for use in faceting. For example:

tags: ['javascript', 'nodejs', 'indextank']

Is it simply a case of breaking these out into tags0: 'javascript', tags1: 'nodejs', tags2: 'indextank'. If so, how do I then consolidate them for use in faceting query results? Or is there a more elegant way of achieving this?

For reference, I guess I'm after something similar to the 'multikeys' feature of MongoDB (http://www.mongodb.org/display/DOCS/Multikeys).

Regards
Simon

Jorge Handl

unread,
Jul 7, 2011, 9:15:41 AM7/7/11
to inde...@googlegroups.com
Hi Simon,

For searching purposes you could just add a field to the document
(let's say "tags") containing "javascript nodejs indextank". If you
need faceting, your multiple category solution would work, and you can
then add the facets from the search result to present a consolidated
number to the user. When the user choses to filter by that
consolidated categroy, you can then create a category filter that uses
the original categories and values (maybe remembed through hidden form
fields).

We're considering adding multi-value category support in the future.
Until then, I hope this not very elegant solution works for you.

Regards,
Jorge

--
--
Jorge Handl
follow us @indextank <http://twitter.com/indextank> and
blog<http://blog.indextank.com>

Simon Weare

unread,
Jul 7, 2011, 9:31:31 AM7/7/11
to inde...@googlegroups.com
Hi Jorge,

Thank for the info. 

I suppose I could use a combination of indextank (for the initial query) then use the results from that to query a sub-set of documents in a multikey index in mongodb. The documents I'm working with are stored locally in mongodb anyway, and, whilst not ideal, I think it's a slightly more elegant solution than trying to fudge multikey indexing features in the client.

Definitely consider me a +1 for 'multi-value category support in the future'. I have quite a few use-cases where this is desirable.

Loving the raw speed and ease of use of the index otherwise!

Simon


Jorge Handl

unread,
Jul 7, 2011, 10:06:02 AM7/7/11
to inde...@googlegroups.com
Simon, I cringe every time a customer has to resort to workarounds like that (not that it happens often, but still). Consider me an advocate for multi-value category support too. :)

Regards,
Jorge
Reply all
Reply to author
Forward
0 new messages