<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
	<channel>
		<title><![CDATA[Latest posts for the topic "multi Index"]]></title>
		<link>http://forum.space4j.org/posts/list/1.page</link>
		<description><![CDATA[Latest messages posted in the topic "multi Index"]]></description>
		<generator>JForum - http://www.jforum.net</generator>
			<item>
				<title>multi Index</title>
				<description><![CDATA[ Hello,<br /> i create index for many attributes and i want to get a list which satisfies more than 1 constraints.<br /> [code]<br /> // indexing QUEUEID, SHIPPINGDONE, TIMENEXTSEND<br /> 		if (!_indexManager.checkIndex(IX_QUEUESV4_GETMSG))<br /> 		{<br /> 			Index _index = new Index(IX_QUEUESV4_GETMSG, MAP_NAME, Index.TYPE.MULTI,<br /> 							QueuesMessage.class, "queueId", "shippingDone", "timeNextSend");<br /> 			boolean _ok = _indexManager.createIndex(_index, m_space4J);<br /> 			// if (_ok)<br /> 			// logger.info(_index + " created !");<br /> 			// else<br /> 			// logger.info("error while creating index" + _index);<br /> 		}<br /> [/code]<br /> Below how we can get list satisfying one constraint.<br /> [code]<br /> List _messages = null;<br /> 		MultiMap _multiMap = (MultiMap) m_indexGetMsg.getMap();<br /> 		_messages = _multiMap.get(new Key(queueId));<br /> 		<br /> 		return _messages;<br /> [/code]<br />  my question is how we can use multi elements ?,  not just one  as i did above [color=red]_multiMap.get(new Key(queueId))[/color] and what we can find on phonebook example.<br /> <br /> thanks for responses.]]></description>
				<guid isPermaLink="true">http://forum.space4j.org/posts/preList/23/56.page</guid>
				<link>http://forum.space4j.org/posts/preList/23/56.page</link>
				<pubDate><![CDATA[Thu, 29 Jul 2010 06:52:16]]> GMT</pubDate>
				<author><![CDATA[ hajmoh]]></author>
			</item>
			<item>
				<title>Re:multi Index</title>
				<description><![CDATA[ <br /> Not sure I followed it, can you rephrase?<br /> ]]></description>
				<guid isPermaLink="true">http://forum.space4j.org/posts/preList/23/57.page</guid>
				<link>http://forum.space4j.org/posts/preList/23/57.page</link>
				<pubDate><![CDATA[Thu, 29 Jul 2010 10:31:31]]> GMT</pubDate>
				<author><![CDATA[ saoj]]></author>
			</item>
			<item>
				<title>Re:multi Index</title>
				<description><![CDATA[ [code]Index _index = new Index(IX_QUEUESV4_GETMSG, MAP_NAME, Index.TYPE.MULTI,  <br />                             QueuesMessage.class, "queueId", "shippingDone", "timeNextSend");[/code]<br /> <br /> above we create an index for the attributes "queueId", "shippingDone", "timeNextSend".<br /> <br /> if i want to research a list that satisfy the constraints queueId = 1, shippingDone =  3 and timeNextSend = 3000.<br /> i find a way just to get a list satisfying juste one constraint ( look the seconde code)<br /> <br /> How can i do it??<br /> <br /> thank you]]></description>
				<guid isPermaLink="true">http://forum.space4j.org/posts/preList/23/58.page</guid>
				<link>http://forum.space4j.org/posts/preList/23/58.page</link>
				<pubDate><![CDATA[Thu, 29 Jul 2010 10:47:47]]> GMT</pubDate>
				<author><![CDATA[ hajmoh]]></author>
			</item>
			<item>
				<title>Re:multi Index</title>
				<description><![CDATA[ Ok. When you are using a compound index, Space4J needs to know how to compare the index's key, which is of course a compound key. <br /> <br /> It does come with a default way of comparing compound keys: the KeyComparator. It compares Strings, Dates and Numbers like you would expect.<br /> <br /> If you want to change the default comparator, because you have some complex objects in the compound key, you have to implement you own comparator and pass to the Index when you create it.<br /> <br /> [code]<br /> public Index(String name, Object source, TYPE type, Comparator&lt;Key&gt; comp, Class&lt;? extends Object&gt; klass, String... attributes)<br /> [/code]<br /> <br /> It does not look like you need your own comparator. If you want to get a list that satisfy queueId = 1, shippingDone = 3 and timeNextSend = 3000 it is very easy:<br /> <br /> 1) Your index should be a MULTI index,  because it is not UNIQUE, meaning you will have more than one record per queueId, shippingDone and timeNextSend.<br /> <br /> 2) It can be sorted or non-sorted, depending if you want to fetch RANGES or if you want to fetch SORTED results.<br /> <br /> 3) After creating your index, all you have to do is:<br /> <br /> [code]<br /> Collection&lt;Object&gt; coll = (Collection&lt;Object&gt;) usersByAge.get(new Key(1, 3, 3000));<br /> [/code]<br /> <br /> If your index is sorted (MULTI_SORTED), you can fetch ranges:<br /> <br /> [code]<br /> Map&lt;Key, Collection&lt;User&gt;&gt; map = usersByAge.subMap(new Key(1, 3, 3000), new Key(1, 3, 5000));<br /> [/code]<br /> <br /> Refer to here to sort from SortedMaps in Java:<br /> <br /> http://download.oracle.com/javase/1.4.2/docs/api/java/util/SortedMap.html<br /> <br /> Plus I also recommend you to download and check the Space4J sources if you want to have a better understanding of its internals.<br /> <br /> [b]Let me know if it worked for you. Also please share with us what kind of system you are developing with Space4J.[/b]<br /> <br /> <br /> ]]></description>
				<guid isPermaLink="true">http://forum.space4j.org/posts/preList/23/59.page</guid>
				<link>http://forum.space4j.org/posts/preList/23/59.page</link>
				<pubDate><![CDATA[Sat, 31 Jul 2010 16:42:42]]> GMT</pubDate>
				<author><![CDATA[ saoj]]></author>
			</item>
			<item>
				<title>Re:multi Index</title>
				<description><![CDATA[ Thank you very much.<br /> I'll test your recommandation and i'll infrom you about results.]]></description>
				<guid isPermaLink="true">http://forum.space4j.org/posts/preList/23/60.page</guid>
				<link>http://forum.space4j.org/posts/preList/23/60.page</link>
				<pubDate><![CDATA[Wed, 4 Aug 2010 03:25:37]]> GMT</pubDate>
				<author><![CDATA[ hajmoh]]></author>
			</item>
			<item>
				<title>Re:multi Index</title>
				<description><![CDATA[ <br /> There were some improvements with Space4J 0.9.2 in the MULTI indexes (sorted and non-sorted).<br /> <br /> Please refer to: <a class="snap_shots" href="http://s4j.mentaframework.org/posts/list/24.page" target="_blank" rel="nofollow">http://s4j.mentaframework.org/posts/list/24.page</a><br /> ]]></description>
				<guid isPermaLink="true">http://forum.space4j.org/posts/preList/23/62.page</guid>
				<link>http://forum.space4j.org/posts/preList/23/62.page</link>
				<pubDate><![CDATA[Sat, 18 Sep 2010 15:48:14]]> GMT</pubDate>
				<author><![CDATA[ saoj]]></author>
			</item>
	</channel>
</rss>
