Index: TXM/trunk/bundles/org.txm.searchengine.cqp.rcp/src/org/txm/searchengine/cqp/rcp/editor/SubcorpusEditor.java
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.rcp/src/org/txm/searchengine/cqp/rcp/editor/SubcorpusEditor.java	(revision 3994)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.rcp/src/org/txm/searchengine/cqp/rcp/editor/SubcorpusEditor.java	(revision 3995)
@@ -32,6 +32,7 @@
 import org.txm.rcp.swt.widget.structures.ContextsSubcorpusPanel;
 import org.txm.rcp.swt.widget.structures.SimpleSubcorpusPanel;
 import org.txm.rcp.views.corpora.CorporaView;
+import org.txm.searchengine.cqp.CQPPreferences;
 import org.txm.searchengine.cqp.corpus.Subcorpus;
 import org.txm.searchengine.cqp.corpus.query.Match;
 
@@ -48,6 +49,9 @@
 	@Parameter(key = TXMPreferences.QUERY)
 	private AssistedChoiceQueryWidget queryWidget;
 	
+	@Parameter(key = CQPPreferences.MATCHINGSTRATEGY)
+	private Text matchingStrategy;
+	
 	Label matchesInfo;
 	Text matchStartsEndsInfo;
 	Composite assistantPanel;
@@ -93,8 +97,8 @@
 			}
 		};
 		
-		getMainParametersComposite().getLayout().numColumns = 4;
-		getMainParametersComposite().getLayout().horizontalSpacing = 2;
+		getMainParametersComposite().getLayout().numColumns = 6;
+		getMainParametersComposite().getLayout().horizontalSpacing = 3;
 		
 		nameLabel = new Label(getMainParametersComposite(), SWT.NONE);
 		nameLabel.setText(TXMUIMessages.name);
@@ -117,6 +121,17 @@
 		queryWidget.addKeyListener(computeKeyListener);
 		queryWidget.getQueryWidget().addModifyListener(computeKeyListener);
 		
+		queryLabel = new Label(getMainParametersComposite(), SWT.NONE);
+		queryLabel.setText("Matching strategy");
+		queryLabel.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
+		
+		matchingStrategy = new Text(this.getMainParametersComposite(), SWT.BORDER);
+		gdata = new GridData(SWT.FILL, SWT.FILL, true, true);
+		gdata.minimumWidth = 200;
+		matchingStrategy.setLayoutData(gdata);
+		matchingStrategy.addKeyListener(computeKeyListener);
+		matchingStrategy.addModifyListener(computeKeyListener);
+		
 		ArrayList<String> modes = new ArrayList<String>();
 		final ArrayList<SelectionListener> listeners = new ArrayList<SelectionListener>();
 		
@@ -247,7 +262,7 @@
 			@Override
 			public void widgetDefaultSelected(SelectionEvent e) {}
 		});
-		modeGroups = this.getTopToolbar().installAlternativesGroup(ASSISTANTS_GROUPNAME, ASSISTANTS_GROUPNAME, IImageKeys.ACTION_ASSISTQUERY, null, false, openCloseSelectionListener, modes, listeners);
+		modeGroups = this.getTopToolbar().installAlternativesGroup(ASSISTANTS_GROUPNAME, ASSISTANTS_GROUPNAME, "platform:/plugin/org.txm.searchengine.cqp.rcp/icons/functions/subcorpus_assistant.png", null, false, openCloseSelectionListener, modes, listeners);
 		modeGroups.setLayout(new GridLayout(1, true));
 		
 		// RESULT AREA
Index: TXM/trunk/bundles/org.txm.searchengine.cqp.rcp/icons/functions/subcorpus_assistant.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: TXM/trunk/bundles/org.txm.searchengine.cqp.rcp/icons/functions/subcorpus_assistant.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: TXM/trunk/bundles/org.txm.conllu.core/src/org/txm/conllu/core/function/UDTreeSearch.java
===================================================================
--- TXM/trunk/bundles/org.txm.conllu.core/src/org/txm/conllu/core/function/UDTreeSearch.java	(revision 3994)
+++ TXM/trunk/bundles/org.txm.conllu.core/src/org/txm/conllu/core/function/UDTreeSearch.java	(revision 3995)
@@ -149,7 +149,7 @@
 					if (buffer.length() > 0) buffer.append("\t");
 					if (prop.equals("form") && startOfSubMatch) buffer.append("[");
 					String v = values.get(prefix+prop)[p];
-					if (v.startsWith("|") && v.endsWith("|")) v = v.substring(1, v.length() - 1); // remove | for CQP multi value
+					if (v.startsWith("|") && v.endsWith("|")) v = v.substring(1, v.length() - 1); // remove the '|' of CQP multi values field
 					buffer.append(v);
 					if (prop.equals("form") && endOfSubMatch) buffer.append("]");
 				}
@@ -254,7 +254,7 @@
 		String prefix = UDPreferences.getInstance().getProjectPreferenceValue(corpus.getProject(), UDPreferences.UDPREFIX, UDPreferences.getInstance().getString(UDPreferences.UDPREFIX));
 		
 		if (pQuery == null || pQuery.getQueryString().length() ==0) {
-			return "["+prefix+"id=\"1\"]";
+			return "["+prefix+"id=\"1(-2)?\"]";
 		} else {
 			return pQuery.getQueryString();
 		}
Index: TXM/trunk/bundles/org.txm.conllu.core/src/org/txm/conllu/core/search/UDSearchEngine.java
===================================================================
--- TXM/trunk/bundles/org.txm.conllu.core/src/org/txm/conllu/core/search/UDSearchEngine.java	(revision 3994)
+++ TXM/trunk/bundles/org.txm.conllu.core/src/org/txm/conllu/core/search/UDSearchEngine.java	(revision 3995)
@@ -133,19 +133,24 @@
 
 	public static Subcorpus getSentenceSubcorpus(CQPCorpus corpus, String prefix) throws CqiClientException, InterruptedException {
 
-		Subcorpus udSentences = corpus.getSubcorpusByName(corpus.getName()+TXMPreferences.PARENT_NAME_SEPARATOR+"ud-s"); //$NON-NLS-1$
-		if (udSentences != null) udSentences.compute(false);
-
+		Subcorpus udSentences = (Subcorpus) corpus.getSubcorpusBySimpleName("ud-s"); //$NON-NLS-1$
 		CQLQuery sentencesQuery = new CQLQuery(getUDSCQPQueryString(prefix));
-		if (udSentences == null) { // no ud-s subcorpus, create it
-			udSentences = corpus.createSubcorpus(sentencesQuery, "ud-s"); //$NON-NLS-1$
-			udSentences.setVisible(false);
+		
+		if (udSentences != null && !udSentences.getQuery().equals(sentencesQuery)) { // this one is not ok, delete it
+			udSentences.delete();
+			udSentences = null;
 		}
-		if (!udSentences.getQuery().equals(sentencesQuery)) { // the subcorpus exists but its query differs 
-			udSentences = corpus.createSubcorpus(sentencesQuery, "ud-s"); //$NON-NLS-1$
+		
+		if (udSentences == null) { // create it
+			udSentences = new Subcorpus(corpus);
+			udSentences.setQuery(sentencesQuery);
+			udSentences.setName("ud-s");
+			udSentences.setMatchingStrategy("longest");
 			udSentences.setVisible(false);
 		}
-
+		
+		udSentences.compute(); // this on is OK, just prepare it to be used
+				
 		return udSentences;
 	}
 	
@@ -156,7 +161,8 @@
 	 */
 	public static String getUDSCQPQueryString(String prefix) {
 		String emptyvalue = TBXPreferences.getInstance().getString(TBXPreferences.EMPTY_PROPERTY_VALUE_CODE);
-		return "["+prefix+"id=\"1(-.+)?\"] []* [:"+prefix+"id=\"1(-.+)?|"+emptyvalue+"\":]";  //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+		//              [ud-id="1(-2)?"]          [ud-id!="1(-2)?|__UNDEF__"]* + longest
+		return "["+prefix+"id=\"1(-2)?\"] ["+prefix+"id!=\"1(-2)?|"+emptyvalue+"\"]*";  //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
 	}
 
 	public String hasAdditionalDetailsForResult(TXMResult result) {
Index: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/CQPPreferences.java
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/CQPPreferences.java	(revision 3994)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/CQPPreferences.java	(revision 3995)
@@ -1,5 +1,6 @@
 package org.txm.searchengine.cqp;
 
+import org.osgi.service.prefs.Preferences;
 import org.txm.core.preferences.TXMPreferences;
 
 /**
@@ -16,6 +17,7 @@
 	 * List of part names.
 	 */
 	public static final String PART_NAMES = "part_names"; //$NON-NLS-1$
+	public static final String MATCHINGSTRATEGY = "matching_strategy";
 	
 	/**
 	 * Gets the instance.
@@ -32,5 +34,8 @@
 	@Override
 	public void initializeDefaultPreferences() {
 		super.initializeDefaultPreferences();
+		
+		Preferences preferences = this.getDefaultPreferencesNode();
+		preferences.put(MATCHINGSTRATEGY, "");
 	}
 }
Index: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/CQPCorpus.java
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/CQPCorpus.java	(revision 3994)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/CQPCorpus.java	(revision 3995)
@@ -50,7 +50,6 @@
 import org.txm.searchengine.cqp.clientExceptions.InvalidCqpIdException;
 import org.txm.searchengine.cqp.core.functions.selection.SelectionResult;
 import org.txm.searchengine.cqp.corpus.query.CQLQuery;
-import org.txm.searchengine.cqp.corpus.query.Match;
 import org.txm.searchengine.cqp.corpus.query.SubcorpusCQLQuery;
 import org.txm.searchengine.cqp.serverException.CqiServerError;
 import org.txm.utils.TXMProgressMonitor;
@@ -1343,9 +1342,9 @@
 	 *            the name
 	 * @return the subcorpus by name
 	 */
-	public CQPCorpus getSubcorpusBySimpleName(String name) {
+	public Subcorpus getSubcorpusBySimpleName(String name) {
 		List<Subcorpus> subcorpora = getSubcorpora();
-		for (CQPCorpus corpus : subcorpora) {
+		for (Subcorpus corpus : subcorpora) {
 			if (corpus.getSimpleName().equals(name)) {
 				return corpus;
 			}
Index: TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/Subcorpus.java
===================================================================
--- TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/Subcorpus.java	(revision 3994)
+++ TXM/trunk/bundles/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/Subcorpus.java	(revision 3995)
@@ -33,6 +33,7 @@
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.HashMap;
+import java.util.HashSet;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.UUID;
@@ -50,6 +51,7 @@
 import org.txm.searchengine.core.Selection;
 import org.txm.searchengine.core.messages.SearchEngineCoreMessages;
 import org.txm.searchengine.cqp.AbstractCqiClient;
+import org.txm.searchengine.cqp.CQPPreferences;
 import org.txm.searchengine.cqp.CQPSearchEngine;
 import org.txm.searchengine.cqp.NetCqiClient;
 import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
@@ -71,24 +73,30 @@
  * @author jmague
  */
 public class Subcorpus extends CQPCorpus {
-	
+
 	/**
 	 * Query used to build the corpus.
 	 */
 	@Parameter(key = TXMPreferences.QUERY)
 	protected IQuery pQuery;
-	
+
+	/**
+	 * Query used to build the corpus.
+	 */
+	@Parameter(key = CQPPreferences.MATCHINGSTRATEGY)
+	protected String pMatchingStrategy;
+
 	protected Selection qresult;
-	
+
 	protected SelectionResult selectionResult;
-	
+
 	/**
 	 * CQP text ids cache
 	 */
 	protected String[] cqpTextIDS = null;
 
+	public static final HashSet<String> matchingStrategies = new HashSet<String>(Arrays.asList("shortest","standard","longest","traditional"));
 
-	
 	/**
 	 * 
 	 * @param corpus
@@ -96,7 +104,7 @@
 	public Subcorpus(CQPCorpus corpus) {
 		super(corpus);
 	}
-	
+
 	/**
 	 * 
 	 * @param partition
@@ -104,7 +112,7 @@
 	public Subcorpus(Partition partition) {
 		super(partition);
 	}
-	
+
 	/**
 	 * 
 	 * @param result parent result
@@ -114,7 +122,7 @@
 		this.pQuery = result.getQuery();
 		this.setUserName(pQuery.toString());
 	}
-	
+
 	/**
 	 * 
 	 * @param parametersNodePath
@@ -122,7 +130,7 @@
 	public Subcorpus(String parametersNodePath) {
 		super(parametersNodePath);
 	}
-	
+
 	/**
 	 * Instantiates a new subcorpus.
 	 * 
@@ -133,16 +141,16 @@
 	 */
 	@Override
 	protected boolean __compute(TXMProgressMonitor monitor) throws Exception {
-		
+
 		if (this.getParent() instanceof QueryBasedTXMResult) { // update the pQuery
 			this.pQuery = ((QueryBasedTXMResult)this.getParent()).getQuery();
 			this.setName(pQuery.getName());
 		}
-		
+
 		if (pID == null || pID.length() == 0) {
 			pID = subcorpusNamePrefix + getNextSubcorpusCounter().toString();
 		}
-		
+
 		if (this.pQuery != null) {
 			this.qresult = null; // reset
 			String parent_id = this.getCorpusParent().getQualifiedCqpId();
@@ -150,7 +158,8 @@
 				Log.warning(NLS.bind("Error: CQL length limit reached ({0}) with {1} length.", CQLQuery.MAX_CQL_LENGTH, pQuery.getQueryString().length())); 
 				return false;
 			}
-			
+
+			AbstractCqiClient CQI = CorpusManager.getCorpusManager().getCqiClient();
 			String q = this.pQuery.getQueryString();
 			if (q.matches("undump \"[^\"]+\";")) { // undump query
 				String path = q.substring(8, q.length() - 2);
@@ -158,38 +167,59 @@
 					Log.severe(NLS.bind("Error: could not compute subcorpus from the dump file: {0}.", path));
 					return false;
 				}
-				CorpusManager.getCorpusManager().getCqiClient().query(this.getCorpusParent().getQualifiedCqpId()+";");
-				CorpusManager.getCorpusManager().getCqiClient().query("undump "+this.pID+" < "+q.substring(7));
+				CQI.query(this.getCorpusParent().getQualifiedCqpId()+";");
+				CQI.query("undump "+this.pID+" < "+q.substring(7));
 			} else if (q.matches("(union|join|intersect|inter|difference|diff) [^ ]+ [^ ]+;")) {
-				CorpusManager.getCorpusManager().getCqiClient().query(this.getCorpusParent().getQualifiedCqpId()+";");
-				CorpusManager.getCorpusManager().getCqiClient().query(this.pID+" = "+q);
+				CQI.query(this.getCorpusParent().getQualifiedCqpId()+";");
+				CQI.query(this.pID+" = "+q);
 			} else {
-				CorpusManager.getCorpusManager().getCqiClient().cqpQuery(parent_id, this.pID, CQLQuery.fixQuery(q, this.getLang()));
-//				if (q.contains("@[") || q.contains("@\"")) {
-//					Log.fine("Target detected in "+q+", recentering on target.");
-//					CorpusManager.getCorpusManager().getCqiClient().cqpQuery(this.getQualifiedCqpId(), this.pID, "<target>[]");
-//				}
+				String previousMatchingStrategy = null;
+				if (matchingStrategies.contains(pMatchingStrategy)) { // set MatchingStrategy for this query
+					previousMatchingStrategy = CQI.getOption("MatchingStrategy");
+					if (previousMatchingStrategy.equals(pMatchingStrategy)) {
+						previousMatchingStrategy = null; // finally no need to change strategy
+					} else { // ok we need to change strategy
+						CQI.setOption("MatchingStrategy", pMatchingStrategy);
+					}
+					
+				}
+				
+				CQI.cqpQuery(parent_id, this.pID, CQLQuery.fixQuery(q, this.getLang()));
+				if (previousMatchingStrategy != null) { // restore MatchingStrategy for this query
+					CQI.setOption("MatchingStrategy", previousMatchingStrategy);
+				}
+				//				if (q.contains("@[") || q.contains("@\"")) {
+				//					Log.fine("Target detected in "+q+", recentering on target.");
+				//					CorpusManager.getCorpusManager().getCqiClient().cqpQuery(this.getQualifiedCqpId(), this.pID, "<target>[]");
+				//				}
 			}
-			
+
 			//this.qresult = this.pQuery.getSearchEngine().query(this.getCorpusParent(), this.pQuery, this.getUserName(), true);
-			
+
 			this.qresult = new QueryResult(this.pID, this.getUserName(), this.getCorpusParent(), (CQLQuery) this.pQuery); // getCorpusParent().query(pQuery, this.pID, true);
 			//  queryResult = new QueryResult(queryResultId, queryResultName, this, query);
 		}
-		
+
 		cqpTextIDS = null; // reset text ids cache
-		
+
 		return qresult != null;
 	}
+
+	public void setMatchingStrategy(String strategy) {
+		this.pMatchingStrategy = strategy;
+	}
 	
-	
+	public String getMatchingStrategy() {
+		return this.pMatchingStrategy;
+	}
+
 	@Override
 	public String getComputingStartMessage() {
-		
+
 		if (this.pQuery == null) {
 			return TXMCoreMessages.bind(SearchEngineCoreMessages.info_computingTheP0SubCorpusOfP1CommaQueryP2, this.getSimpleName(), this.getParent().getName(), "<no query>");
 		}
-		
+
 		// created with structure, property and value(s)
 		if (this.pQuery instanceof SubcorpusCQLQuery) {
 			SubcorpusCQLQuery query = (SubcorpusCQLQuery) this.pQuery;
@@ -201,7 +231,7 @@
 			return TXMCoreMessages.bind(SearchEngineCoreMessages.info_computingTheP0SubCorpusOfP1CommaQueryP2, this.getSimpleName(), this.getParent().getName(), this.getQuery().asString());
 		}
 	}
-	
+
 	/*
 	 * retro compatibility method for import.xml file
 	 * @see org.txm.searchengine.cqp.corpus.Corpus#getLocale()
@@ -212,7 +242,7 @@
 			this.setUserName(e.getAttribute(NAME));
 			this.pID = "S" + getNextSubcorpusCounter();
 			this.pQuery = new CQLQuery(e.getAttribute("query")); //$NON-NLS-1$
-			
+
 			NodeList subcorpusElems = e.getElementsByTagName("subcorpus"); //$NON-NLS-1$
 			for (int i = 0; i < subcorpusElems.getLength(); i++) {
 				Element subcorpusElem = (Element) subcorpusElems.item(i);
@@ -224,14 +254,14 @@
 					Log.warning(TXMCoreMessages.bind(TXMCoreMessages.failedToRestoreTheP0SubcorpusOfP1P2, this.pID, subcorpusElem.getAttribute("name"), ex)); //$NON-NLS-1$
 				}
 			}
-			
+
 			NodeList partitionElems = e.getElementsByTagName("partition"); //$NON-NLS-1$
 			for (int i = 0; i < partitionElems.getLength(); i++) {
 				Element partitionElem = (Element) partitionElems.item(i);
 				String name = partitionElem.getAttribute("name"); //$NON-NLS-1$
 				List<String> names = new ArrayList<>();
 				List<String> queries = new ArrayList<>();
-				
+
 				NodeList partElems = partitionElem.getElementsByTagName("part"); //$NON-NLS-1$
 				for (int j = 0; j < partElems.getLength(); j++) {
 					Element part = (Element) partElems.item(j);
@@ -255,13 +285,13 @@
 		// return super.load();
 		return true;
 	}
-	
+
 	@Override
 	public boolean canCompute() {
 		return getUserName() != null && getUserName().length() > 0 &&
 				((pQuery != null && pQuery.getQueryString().length() > 0) || qresult != null);
 	}
-	
+
 	/*
 	 * (non-Javadoc)
 	 * @see
@@ -274,11 +304,11 @@
 			throw new InvalidCqpIdException(TXMCoreMessages.bind(CQPSearchEngineCoreMessages.p0IsNotAValidCQPIDForASubcorpusItMustBeAnUppercaseCharacterFollowedByLowercaseCharacters, pID));
 		return true;
 	}
-	
+
 	@Override
 	public void clean() {
 		super.clean();
-		
+
 		// nothing to do if the corpus has not yet been computed
 		if (this.hasBeenComputedOnce()) {
 			try {
@@ -293,12 +323,12 @@
 				Log.printStackTrace(e);
 			}
 		}
-		
+
 		qresult = null;
 		selectionResult = null;
 	}
-	
-	
+
+
 	@Override
 	public List<? extends Match> getMatches() {
 		if (qresult == null) { // not computed
@@ -312,7 +342,7 @@
 			return new ArrayList<>();
 		}
 	}
-	
+
 	public int getNMatch() {
 		try {
 			return qresult.getNMatch();
@@ -323,7 +353,7 @@
 			return 0;
 		}
 	}
-	
+
 	// protected void finalize() throws Throwable {
 	// try {
 	// //
@@ -338,7 +368,7 @@
 	// super.finalize();
 	// }
 	// }
-	
+
 	/*
 	 * (non-Javadoc)
 	 * @see
@@ -348,7 +378,7 @@
 	public String getQualifiedCqpId() {
 		return getMainCorpus().getCqpId() + ":" + this.pID; //$NON-NLS-1$
 	}
-	
+
 	// /**
 	// * Register to parent.
 	// *
@@ -381,7 +411,7 @@
 	//
 	// this._load();
 	// }
-	
+
 	/**
 	 * Gets the query.
 	 *
@@ -390,17 +420,17 @@
 	public IQuery getQuery() {
 		return pQuery;
 	}
-	
+
 	@Override
 	public String getResultType() {
 		return "Corpus";
 	}
-	
+
 	public SelectionResult getSelectionResult() {
 		return selectionResult;
 	}
-	
-	
+
+
 	/**
 	 * Returns the number of occurrences in the subcorpus.
 	 * 
@@ -414,11 +444,11 @@
 	@Override
 	public int getSize() throws CqiClientException {
 		if (!this.hasBeenComputedOnce()) return 0;
-		
+
 		if (this.size == -1) {
 			// Log.finest(TXMCoreMessages.bind(TXMCoreMessages.SUBCORPUS_SIZE, new Object[]{this.pName, "N/A"}));
 			long start = System.currentTimeMillis();
-			
+
 			try {
 				AbstractCqiClient cqiClient = CorpusManager.getCorpusManager().getCqiClient();
 				String qid = this.getQualifiedCqpId();
@@ -434,7 +464,7 @@
 						throw new UnexpectedAnswerException();
 					}
 					this.size = 0;
-					
+
 					for (int i = 0; i < match.length; i++) {
 						size += matchend[i] - match[i] + 1;
 					}
@@ -448,13 +478,13 @@
 		}
 		return this.size;
 	}
-	
+
 	@Override
 	public int[] getStartLimits(String sup) throws IOException,
 	CqiServerError, InvalidCqpIdException, CqiClientException {
 		return this.getMainCorpus().getStartLimits(sup);
 	}
-	
+
 	/*
 	 * (non-Javadoc)
 	 * @see
@@ -466,7 +496,7 @@
 			throws CqiClientException {
 		return getMainCorpus().getStructuralUnit(name);
 	}
-	
+
 	/*
 	 * (non-Javadoc)
 	 * @see org.txm.searchengine.cqp.corpus.Corpus#getStructuralUnits()
@@ -475,21 +505,21 @@
 	public List<StructuralUnit> getStructuralUnits() throws CqiClientException {
 		return getMainCorpus().getStructuralUnits();
 	}
-	
+
 	public SelectionResult initSelectionResult(Element e) {
-		
+
 		if (e != null) {
 			selectionResult = new SelectionResult();
 			NodeList selectionList = e.getElementsByTagName("selection"); //$NON-NLS-1$
 			for (int i = 0; i < selectionList.getLength();) {
 				Element selection = (Element) selectionList.item(i); // the selection element
-				
+
 				NodeList textList = selection.getElementsByTagName("selText"); // get text ids //$NON-NLS-1$
 				for (int j = 0; j < textList.getLength(); j++) {
 					Element text = (Element) textList.item(j);
 					selectionResult.add(text.getAttribute("id")); //$NON-NLS-1$
 				}
-				
+
 				NodeList critList = selection.getElementsByTagName("selCrit"); // get the criteria //$NON-NLS-1$
 				for (int j = 0; j < critList.getLength(); j++) {
 					Element crit = (Element) critList.item(j);
@@ -503,17 +533,17 @@
 		}
 		return selectionResult;
 	}
-	
+
 	@Override
 	public boolean loadParameters() throws Exception {
 		String q = this.getStringParameterValue(TXMPreferences.QUERY);
 		if (!q.isEmpty()) {
 			pQuery = new CQLQuery(q);
 		}
-		
+
 		return true;
 	}
-	
+
 	@Override
 	public boolean saveParameters() throws Exception {
 		if (pQuery != null) {
@@ -521,7 +551,7 @@
 		}
 		return true;
 	}
-	
+
 	/**
 	 * Instantiates a new subcorpus.
 	 * 
@@ -534,12 +564,12 @@
 	 *             {@link CQPCorpus#createSubcorpus(CQLQuery, String)}
 	 */
 	protected void setParameters(String pID, String name, CQLQuery query) throws InvalidCqpIdException {
-		
+
 		this.pID = pID;
 		this.pQuery = query;
 		this.setUserName(name);
 	}
-	
+
 	/**
 	 * 
 	 * @param cqpId
@@ -547,15 +577,15 @@
 	 * @param queryResult
 	 */
 	public void setParameters(String cqpId, String name, QueryResult queryResult) {
-		
+
 		this.pID = cqpId;
 		this.setUserName(name);
 		this.pQuery = queryResult.getQuery();
 		this.qresult = queryResult;
-		
+
 		this.setDirty();
 	}
-		
+
 	/**
 	 * Sets the query to use.
 	 * 
@@ -564,8 +594,8 @@
 	public void setQuery(CQLQuery query) {
 		this.pQuery = query;
 	}
-	
-	
+
+
 	// TODO merge SelectionResult and Subcorpus ?
 	public void setSelectionResult(SelectionResult selectionResult) {
 		this.selectionResult = selectionResult;
@@ -597,7 +627,7 @@
 		// getSelfElement().appendChild(selectionElem);// append selection elem to self
 		// }
 	}
-	
+
 	/*
 	 * (non-Javadoc)
 	 * @see java.lang.Object#toString()
@@ -606,23 +636,23 @@
 	public String toString() {
 		return this.getName();
 	}
-	
+
 	@Override
 	@Deprecated
 	public boolean _toTxt(File outfile, String encoding, String colseparator, String txtseparator) throws Exception {
 		return false;
 	}
-	
+
 	@Override
 	public void setIsModified(boolean b) {
 		// nothing
 	}
-	
+
 	@Override
 	public CorpusBuild getRootCorpusBuild() {
 		return getMainCorpus();
 	}
-	
+
 	/**
 	 * Return the CQP START positions of the main corpus texts
 	 */
@@ -633,7 +663,7 @@
 		}
 		return textLimits;
 	}
-	
+
 	/**
 	 * Return the CQP END positions of the main corpus texts
 	 */
@@ -648,7 +678,7 @@
 		}
 		return textEndLimits;
 	}
-	
+
 	/**
 	 * Gets the nb texts.
 	 *
@@ -660,27 +690,27 @@
 	@Override
 	public int getNbTexts() throws CqiClientException, IOException, CqiServerError {
 		if (nbtext == -1) {
-			
+
 			List<Integer> structsIncorpus = getTextNumberInCorpus();
-			
+
 			nbtext = structsIncorpus.size();
 		}
 		return nbtext;
 	}
-	
+
 	private List<Integer> getTextNumberInCorpus() throws CqiClientException, IOException, CqiServerError {
-		
+
 		StructuralUnit text_su = this.getStructuralUnit("text"); //$NON-NLS-1$
 		StructuralUnitProperty text_id_sup = text_su.getProperty("id"); //$NON-NLS-1$
 		nbtext = CorpusManager.getCorpusManager().getCqiClient().attributeSize(text_id_sup.getQualifiedName());
-		
+
 		int[] structs = new int[nbtext];
 		int[][] structs_positions = new int[structs.length][2];
 		for (int i = 0; i < nbtext; i++) {
 			structs[i] = i;
 			structs_positions[i] = CorpusManager.getCorpusManager().getCqiClient().struc2Cpos(text_id_sup.getQualifiedName(), i);
 		}
-		
+
 		List<Integer> structsIncorpus = new ArrayList<>();
 		// filter structs with matches
 		List<? extends Match> matches = this.getMatches();
@@ -701,7 +731,7 @@
 		}
 		return structsIncorpus;
 	}
-	
+
 	/**
 	 * 
 	 * @return the text_id values of the CQP corpus ordered by position
@@ -711,22 +741,22 @@
 	 */
 	@Override
 	public String[] getCorpusTextIdsList() throws CqiClientException, IOException, CqiServerError {
-		
+
 		if (cqpTextIDS == null) {
 			StructuralUnit text_su = this.getStructuralUnit("text"); //$NON-NLS-1$
 			StructuralUnitProperty text_id_sup = text_su.getProperty("id"); //$NON-NLS-1$
-			
+
 			List<Integer> list = getTextNumberInCorpus();
 			int[] structs = new int[list.size()];
 			for (int i = 0; i < list.size(); i++) {
 				structs[i] = list.get(i);
 			}
-			
+
 			cqpTextIDS = CorpusManager.getCorpusManager().getCqiClient().struc2Str(text_id_sup.getQualifiedName(), structs);
 		}
 		return cqpTextIDS;
 	}
-	
+
 	/**
 	 * Gets the texts ids and order number in corpus.
 	 *
@@ -744,10 +774,10 @@
 			for (int i = 0; i < list.size(); i++) {
 				structs[i] = list.get(i);
 			}
-			
+
 			StructuralUnit text_su = this.getStructuralUnit("text"); //$NON-NLS-1$
 			StructuralUnitProperty text_id_sup = text_su.getProperty("id"); //$NON-NLS-1$
-			
+
 			String[] ids = CorpusManager.getCorpusManager().getCqiClient().struc2Str(text_id_sup.getQualifiedName(), structs);
 			for (int i = 0; i < ids.length; i++) {
 				textids.put(ids[i], structs[i]);
@@ -755,12 +785,12 @@
 		}
 		return textids;
 	}
-	
+
 	@Override
 	public String getName() {
 		return this.getCorpusParent().getSimpleName() + TXMPreferences.PARENT_NAME_SEPARATOR + this.getSimpleName();
 	}
-	
+
 	@Override
 	public String getDetails() {
 		try {
@@ -777,17 +807,17 @@
 
 	@Override
 	public List<?> isBuildValid() {
-		
+
 		if (this.getParent() != null) return new LinkedList<String>(); // ok
-		
+
 		return Arrays.asList("No parent corpus result");
 	}
 
 	@Override
 	public String isReady() {
-		
+
 		if (!hasBeenComputedOnce()) return "the subcorpus is not a computed TXMResult";
-		
+
 		try {
 			int s = this.getSize();
 			if (s >= 0) return null;
