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 muneeb <mu...@hotmail.com> on 2010/03/09 15:49:09 UTC
indexing key/value field type
Hi,
I have built an index of several million documents with all primitive type
fields, either String, text or int. I have another multivalued field to
index now for each document which is a list of tags as a hashmap, so:
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.
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?
I guess the final option I have is to make my custom field type and analyzer
to deal with this... Any suggestions on how i should i go about this??
Thanks very much in advance.
-Ali
--
View this message in context: http://old.nabble.com/indexing-key-value-field-type-tp27836710p27836710.html
Sent from the Solr - User mailing list archive at Nabble.com.
Re: indexing key/value field type
Posted by Chris Hostetter <ho...@fucit.org>.
: 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