Mehul,
Facets are typically implemented using cts:element-values (or
cts:element-attribute-values) to enumerate items in a value lexicon and
cts:frequency to get the counts. What does that mean? A lexicon keeps track of
the values in a particular element (or element-attribute pair). MarkLogic uses
a range index to make lookups and aggregations based on a lexicon fast. In your
example below, you’d create an element range index on the city element. The
index will accommodate "multi-word” values. For example, “New York” is a string
value just as “Boston” is; one just happens to have a space character. In your
application you’d use something like
cts:element-values(QName("”, “city"), "", ("frequency-order”))
to get the possible values. Then for each value call cts:frequency to get the
count. I’ve got provided an illustration using the cts builtins as well as the
Search API in an earlier thread
<http://marklogic.markmail.org/thread/gif4oqs2t4el5ftn>.
Please let me know if you have further questions or concerns.
Justin
Justin Makeig
Senior Product Manager
MarkLogic Corporation
email [email protected]<mailto:[email protected]>
web www.marklogic.com<http://www.marklogic.com/>
This e-mail and any accompanying attachments are confidential. The information
is intended solely for the use of the individual to whom it is addressed. Any
review, disclosure, copying, distribution, or use of this e-mail communication
by others is strictly prohibited. If you are not the intended recipient, please
notify us immediately by returning this message to the sender and delete all
copies. Thank you for your cooperation.
On Oct 14, 2010, at 1:42 PM, Shah, Mehul (LNG-NPV) wrote:
I hope someone can provide me clue to how to do "multi word facet".
Thanks again!
-----Original Message-----
From:
[email protected]<mailto:[email protected]>
[mailto:[email protected]] On Behalf Of Shah, Mehul
(LNG-NPV)
Sent: Wednesday, October 06, 2010 1:50 PM
To: General Mark Logic Developer Discussion
Subject: [MarkLogic Dev General] facet with multiple words
How do I construct facet with multi-words (or exact content) of an element or
attribute?
For example:
Doc1- <doc>...<city>New York</city>...</doc>
Doc2- <doc>...<city>Orlando</city>...</doc>
Doc3- <doc>...<city>Old Bridge</city>...</doc>
Doc4- <doc>...<city>word1 word2 word3</city>...</doc>
...
Now I search a term, and that matched doc2 and doc3 along with many other docs.
I would like to get facet information like this...
[city name - (document hits for the search)]
Orlando - (5)
Old Bridge - (10)
Thanks,
Mehul.
_______________________________________________
General mailing list
[email protected]<mailto:[email protected]>
http://developer.marklogic.com/mailman/listinfo/general
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general