Index: tmp/org.txm.links.rcp/src/org/txm/links/rcp/handlers/SendSelectionToMatchable.java
===================================================================
--- tmp/org.txm.links.rcp/src/org/txm/links/rcp/handlers/SendSelectionToMatchable.java	(revision 2493)
+++ tmp/org.txm.links.rcp/src/org/txm/links/rcp/handlers/SendSelectionToMatchable.java	(revision 2494)
@@ -48,15 +48,16 @@
  * 
  */
 public abstract class SendSelectionToMatchable extends BaseAbstractHandler {
-
+	
 	/**
 	 * Creates the queries.
 	 * This method is essentially dedicated to be overridden, if needed.
+	 * 
 	 * @param selection
 	 * @return
 	 */
 	public abstract List<Match> createMatches(ExecutionEvent event, IStructuredSelection selection);
-
+	
 	@Override
 	public Object execute(ExecutionEvent event) throws ExecutionException {
 		
@@ -65,22 +66,28 @@
 			
 			List<Match> matches = this.createMatches(event, selection);
 			
-			if(matches.isEmpty()) {
+			if (matches.isEmpty()) {
 				Log.severe(Messages.noMatchesWasSetCommandCanceled);
 				return null;
 			}
 			
 			// create a local result node in the project node, store in some parameters and call the linked command
-			String resultParametersNodePath = this.getResultParent(event).getProject().getParametersNodeRootPath() + TXMResult.createUUID() + "_link"; // FIXME: we can't put the class name here since we does not know the target class
-			TXMPreferences.put(resultParametersNodePath, TXMPreferences.PARENT_PARAMETERS_NODE_PATH, this.getResultParent(event).getParametersNodePath());
+			TXMResult result = this.getResultParent(event);
+			if (result == null) {
+				System.out.println("No result found with " + event);
+				return null;
+			}
+			String resultParametersNodePath = result.getProject().getParametersNodeRootPath() + TXMResult.createUUID() + "_link"; // FIXME: we can't put the class name here since we does not know the
+																																	 // target class
+			TXMPreferences.put(resultParametersNodePath, TXMPreferences.PARENT_PARAMETERS_NODE_PATH, result.getParametersNodePath());
 			TXMPreferences.put(resultParametersNodePath, TXMPreferences.MATCHES, matches.toString());
 			
 			BaseAbstractHandler.executeSendToCommand(event.getCommand().getId(), resultParametersNodePath);
 		}
-		else	{
+		else {
 			this.logCanNotExecuteCommand(selection);
 		}
 		return null;
 	}
-
-}
\ No newline at end of file
+	
+}
Index: tmp/org.txm.links.rcp/src/org/txm/links/rcp/handlers/SendSelectionToQueryable.java
===================================================================
--- tmp/org.txm.links.rcp/src/org/txm/links/rcp/handlers/SendSelectionToQueryable.java	(revision 2493)
+++ tmp/org.txm.links.rcp/src/org/txm/links/rcp/handlers/SendSelectionToQueryable.java	(revision 2494)
@@ -45,17 +45,19 @@
  * 
  */
 public abstract class SendSelectionToQueryable extends BaseAbstractHandler {
-
+	
 	/**
 	 * Creates the query.
+	 * 
 	 * @param isel
 	 * @return
 	 */
 	public abstract String createQuery(ExecutionEvent event, ISelection isel);
-	 
+	
 	/**
 	 * Creates the queries.
 	 * This method is essentially dedicated to be overridden, if needed.
+	 * 
 	 * @param selection
 	 * @return
 	 */
@@ -73,23 +75,25 @@
 			String query = this.createQuery(event, selection);
 			String queries = this.createQueries(event, selection);
 			
-			if(query.isEmpty() && queries.isEmpty()) {
+			if (query.isEmpty() && queries.isEmpty()) {
 				Log.severe(Messages.noQueryWasSetCommandCanceled);
 				return null;
 			}
 			
 			// create a local result node in the project node, store in some parameters and call the linked command
-			String resultParametersNodePath = this.getResultParent(event).getProject().getParametersNodeRootPath() + TXMResult.createUUID() + "_link"; // FIXME: we can't put the class name here since we does not know the target class
-			TXMPreferences.put(resultParametersNodePath, TXMPreferences.PARENT_PARAMETERS_NODE_PATH, this.getResultParent(event).getParametersNodePath());
+			TXMResult result = this.getResultParent(event);
+			String resultParametersNodePath = result.getProject().getParametersNodeRootPath() + TXMResult.createUUID() + "_link"; // FIXME: we can't put the class name here since
+																																	 // we does not know the target class
+			TXMPreferences.put(resultParametersNodePath, TXMPreferences.PARENT_PARAMETERS_NODE_PATH, result.getParametersNodePath());
 			TXMPreferences.put(resultParametersNodePath, TXMPreferences.QUERY, query);
 			TXMPreferences.put(resultParametersNodePath, TXMPreferences.QUERIES, queries);
 			
 			BaseAbstractHandler.executeSendToCommand(event.getCommand().getId(), resultParametersNodePath);
 			
 		}
-		else	{
+		else {
 			this.logCanNotExecuteCommand(selection);
 		}
 		return null;
 	}
-}
\ No newline at end of file
+}
Index: tmp/org.txm.index.core/src/org/txm/index/core/functions/Index.java
===================================================================
--- tmp/org.txm.index.core/src/org/txm/index/core/functions/Index.java	(revision 2493)
+++ tmp/org.txm.index.core/src/org/txm/index/core/functions/Index.java	(revision 2494)
@@ -171,8 +171,6 @@
 	@Override
 	protected boolean _compute() throws Exception {
 		
-		
-		
 		// reset all stored data
 		if (lines != null) {
 			lines.clear();
@@ -978,9 +976,11 @@
 	 * @param reverse the reverse
 	 */
 	public void sortLines(LineComparator.SortMode mode, boolean reverse) {
-		LineComparator lc = new LineComparator(mode, reverse);
+		LineComparator lc = new LineComparator(mode, 0, reverse);
 		lc.initialize(this.getCorpus());
+		
 		Collections.sort(lines, lc);
+		
 		this.pTopIndex = 0; // return to the first page
 	}
 	
Index: tmp/org.txm.index.core/src/org/txm/index/core/functions/LineComparator.java
===================================================================
--- tmp/org.txm.index.core/src/org/txm/index/core/functions/LineComparator.java	(revision 2493)
+++ tmp/org.txm.index.core/src/org/txm/index/core/functions/LineComparator.java	(revision 2494)
@@ -62,15 +62,18 @@
 	/** The reverse. */
 	boolean reverse;
 	
+	int focusedSubcorpus = 0;
+	
 	/**
 	 * Instantiates a new line comparator.
 	 *
 	 * @param mode the mode
 	 * @param reverse the reverse
 	 */
-	public LineComparator(SortMode mode, boolean reverse) {
+	public LineComparator(SortMode mode, int focusedSubcorpus, boolean reverse) {
 		setSortByFrequence(mode);
 		setReverse(reverse);
+		this.focusedSubcorpus = focusedSubcorpus;
 	}
 	
 	/**
@@ -91,7 +94,7 @@
 		int sort = 0;
 		switch (currentsortmode) {
 			case FREQUNIT:
-				sort = arg0.getFrequency() - arg1.getFrequency();
+				sort = arg0.getFrequency(focusedSubcorpus) - arg1.getFrequency(focusedSubcorpus);
 				
 				if (sort == 0)
 					sort = -collator.compare(arg0.toString(), arg1.toString());
@@ -101,19 +104,21 @@
 			case UNITFREQ:
 				sort = collator.compare(arg0.toString(), arg1.toString());
 				if (sort == 0)
-					sort = arg0.getFrequency() - arg1.getFrequency();
+					sort = arg0.getFrequency(focusedSubcorpus) - arg1.getFrequency(focusedSubcorpus);
 				break;
 			
 			case FREQ:
-				sort = arg0.getFrequency() - arg1.getFrequency();
+				sort = arg0.getFrequency(focusedSubcorpus) - arg1.getFrequency(focusedSubcorpus);
 				break;
 			
 			case UNIT:
 				sort = collator.compare(arg0.toString(), arg1.toString());
 				break;
 		}
-		if (reverse)
+		
+		if (reverse) {
 			sort = -sort;
+		}
 		return sort;
 	}
 	
Index: tmp/org.txm.index.core/src/org/txm/index/core/functions/PartitionIndex.java
===================================================================
--- tmp/org.txm.index.core/src/org/txm/index/core/functions/PartitionIndex.java	(revision 2493)
+++ tmp/org.txm.index.core/src/org/txm/index/core/functions/PartitionIndex.java	(revision 2494)
@@ -32,37 +32,23 @@
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.OutputStreamWriter;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
 import java.util.HashMap;
-import java.util.LinkedHashMap;
 import java.util.List;
 
 import org.eclipse.osgi.util.NLS;
 import org.rosuda.REngine.REXPMismatchException;
 import org.txm.core.messages.TXMCoreMessages;
 import org.txm.core.preferences.TXMPreferences;
-import org.txm.core.results.Parameter;
-import org.txm.core.results.TXMParameters;
-import org.txm.core.results.TXMResult;
 import org.txm.index.core.functions.LineComparator.SortMode;
 import org.txm.index.core.messages.IndexCoreMessages;
-import org.txm.index.core.preferences.IndexPreferences;
-import org.txm.objects.Match;
-import org.txm.searchengine.core.IQuery;
-import org.txm.searchengine.core.Selection;
 import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
 import org.txm.searchengine.cqp.corpus.CQPCorpus;
 import org.txm.searchengine.cqp.corpus.CQPLexicon;
-import org.txm.searchengine.cqp.corpus.CorpusManager;
 import org.txm.searchengine.cqp.corpus.Part;
 import org.txm.searchengine.cqp.corpus.Partition;
 import org.txm.searchengine.cqp.corpus.Property;
-import org.txm.searchengine.cqp.corpus.StructuralUnitProperty;
 import org.txm.searchengine.cqp.corpus.WordProperty;
 import org.txm.searchengine.cqp.corpus.query.CQLQuery;
-import org.txm.searchengine.cqp.serverException.CqiServerError;
 import org.txm.statsengine.r.core.RWorkspace;
 import org.txm.statsengine.r.core.exceptions.RWorkspaceException;
 import org.txm.utils.logger.Log;
@@ -73,24 +59,13 @@
  * @author mdecorde
  * @author sjacquot
  */
-// FIXME: SJ: chzeck that all works well then remove the partnamtes usage
+// FIXME: SJ: check that all works well then remove the partnames usage
 public class PartitionIndex extends Index {
 	
-	
 	/** The lexicon used to compute the index (if query = null || query == [] && properties.size() == 1 */
 	@Deprecated
 	protected CQPLexicon lexicon;
 	
-	@Deprecated
-	protected boolean lexiconMode = false;
-	
-	// /**
-	// * Partition part names.
-	// */
-	// protected List<String> partNames = new ArrayList<>();
-	
-	
-	
 	/**
 	 * 
 	 * @param parent
@@ -113,12 +88,6 @@
 	 */
 	public PartitionIndex(String parametersNodePath, Partition parent) {
 		super(parametersNodePath, parent);
-		//
-		// Partition partition = getParent();
-		// partNames.clear();
-		// for (Part part : partition.getParts()) {
-		// partNames.add(part.getName());
-		// }
 	}
 	
 	@Override
@@ -126,17 +95,12 @@
 		return (Partition) parent;
 	}
 	
-	
-	
 	@Override
 	public String getComputingStartMessage() {
 		return TXMCoreMessages.bind(IndexCoreMessages.indexOfP0PropertiesP1OnP2Partition, this.pQuery, WordProperty.propertiesToString(this.pProperties).replaceAll(TXMPreferences.LIST_SEPARATOR,
 				", "), this.getPartition().getSimpleName()); //$NON-NLS-1$
 	}
 	
-	
-	
-	
 	@Override
 	protected boolean _compute() throws Exception {
 		lines.clear();
@@ -146,11 +110,9 @@
 		nTotalTokens = 0;
 		
 		Partition partition = getParent();
-		// partNames.clear();
 		for (Part part : partition.getParts()) {
 			scanCorpus(part);
 			currentpartid++;
-			// partNames.add(part.getName());
 		}
 		
 		setLineCounts();
@@ -286,12 +248,6 @@
 		return lexicon;
 	}
 	
-	public boolean getLexiconMode() {
-		return this.lexiconMode;
-	}
-	
-	
-	
 	/**
 	 * update the lines counts.
 	 */
Index: tmp/org.txm.index.rcp/src/org/txm/index/rcp/handlers/SendIndexTo.java
===================================================================
--- tmp/org.txm.index.rcp/src/org/txm/index/rcp/handlers/SendIndexTo.java	(revision 2493)
+++ tmp/org.txm.index.rcp/src/org/txm/index/rcp/handlers/SendIndexTo.java	(revision 2494)
@@ -29,13 +29,13 @@
 
 import org.eclipse.core.commands.ExecutionEvent;
 import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
 import org.eclipse.jface.viewers.StructuredSelection;
 import org.eclipse.ui.handlers.HandlerUtil;
 import org.txm.core.results.TXMResult;
 import org.txm.index.core.functions.Index;
 import org.txm.links.rcp.handlers.SendSelectionToQueryable;
 import org.txm.rcp.editors.TXMEditor;
+import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
 import org.txm.searchengine.cqp.corpus.CQPCorpus;
 import org.txm.searchengine.cqp.corpus.query.CQLQuery;
 
@@ -47,7 +47,6 @@
  */
 public class SendIndexTo extends SendSelectionToQueryable {
 	
-	
 	@Override
 	public String createQuery(ExecutionEvent event, ISelection selection) {
 		if (selection instanceof StructuredSelection) {
@@ -66,14 +65,30 @@
 		return null;
 	}
 	
-	
-	
 	@Override
 	public TXMResult getResultParent(ExecutionEvent event) {
-		TXMEditor editor = (TXMEditor) HandlerUtil.getActiveWorkbenchWindow(event).getActivePage().getActivePart();
-		return CQPCorpus.getFirstParentCorpus(editor.getResult());
+		@SuppressWarnings("unchecked")
+		TXMEditor<Index> editor = (TXMEditor<Index>) HandlerUtil.getActiveWorkbenchWindow(event).getActivePage().getActivePart();
+		
+		TXMResult result = editor.getResult();
+		Index index = (Index) result;
+		CQPCorpus corpus = CQPCorpus.getFirstParentCorpus(index);
+		if (index.getQuery() instanceof CQLQuery) {
+			CQLQuery cqlQuery = (CQLQuery) index.getQuery();
+			CQPCorpus subcorpus;
+			try {
+				subcorpus = corpus.createSubcorpus(cqlQuery, cqlQuery.getQueryString());
+			}
+			catch (CqiClientException e) {
+				// TODO Auto-generated catch block
+				e.printStackTrace();
+				return null;
+			}
+			
+			return subcorpus;
+		}
+		else {
+			return null;
+		}
 	}
-	
-	
-	
 }
