: tags<key,value> , where key is String and value is Int.
: key is a given tag and value is a count of how many users used this tag for
: a given document.
: 
: How can I index and store a key/value type of field? such that one can
: search on the values as well as keys of this field. 

It depends on what types of searches you want to do.

Some people only care about searching on the tag "string" and just want 
the numeric value to "boost" the score -- in which case Payloads work 
really well (and there's already a Tokenizer that makes it easy to index 
the pairs, but i think you still need a custom QParser to query them)

If you actaully want to be able to apply arbitrary numeric constraints 
(ie: "find all docs where more then 13 and less then 34 people applied teh 
tag 'food'" then things get a lot more complicated ... you can do it with 
parallel fields (ie: the tags in one multiValued string field, and the 
numbers in another multiValued int field) but then you really have to 
write a lot of custom query code to pay attention to the position info 
when evaluating matches.

: I have looked at FAQs, where one mailing-list suggests using the dynamic
: field type such as: 
: 
: <dynamicField name="tags_*" type="string" indexed="true" stored="true"
: omitNorms="true" />
: 
: but how would we search on the dynamic field names?

        tags_food:[13 TO 34]

...if you want to know if a document has a tag at all, you could use 
something like tags_food:[* TO *] or lump all the tag strings into a 
"tags" field as well (tags:food)


-Hoss

Reply via email to