Index: tmp/org.txm.core/src/java/org/txm/core/engines/EngineType.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/core/engines/EngineType.java	(revision 1074)
+++ tmp/org.txm.core/src/java/org/txm/core/engines/EngineType.java	(revision 1075)
@@ -16,7 +16,7 @@
 	SCRIPT("scripts"),
 	ANNOTATION("annotations"),
 	TAL("tal"),
-	OTHER("others engines");
+	OTHER("others engines"), IMPORT("import");
 
 	/**
 	 * Description.
Index: tmp/org.txm.core/src/java/org/txm/core/engines/ImportEngine.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/core/engines/ImportEngine.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/core/engines/ImportEngine.java	(revision 1075)
@@ -0,0 +1,22 @@
+package org.txm.core.engines;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.txm.objects.Project;
+
+public abstract class ImportEngine implements Engine {
+
+	public static final String EXTENSION_POINT_ID = ImportEngine.class.getCanonicalName();
+	
+	@Override
+	public abstract String getName();
+	
+	/**
+	 * Regenerate all project results
+	 *  
+	 * @param project
+	 * @param monitor
+	 * @return
+	 */
+	public abstract boolean build(Project project, IProgressMonitor monitor);
+
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/core/engines/ImportEngine.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/core/engines/ImportEngines.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/core/engines/ImportEngines.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/core/engines/ImportEngines.java	(revision 1075)
@@ -0,0 +1,32 @@
+package org.txm.core.engines;
+
+public class ImportEngines extends EnginesManager<ImportEngine>{
+
+	@Override
+	public boolean fetchEngines() {
+		return this.fetchEngines(ImportEngine.EXTENSION_POINT_ID);
+	}
+
+	@Override
+	public EngineType getEnginesType() {
+		return EngineType.IMPORT;
+	}
+	
+	// commons import modules
+	
+	public ImportEngine getTXTEngine() {
+		return this.getEngine("txt");
+	}
+	
+	public ImportEngine getXTZEngine() {
+		return this.getEngine("xtz");
+	}
+	
+	public ImportEngine getXMLEngine() {
+		return this.getEngine("xmlw");
+	}
+		
+	public ImportEngine getTranscriberEngine() {
+		return this.getEngine("transcriber");
+	}
+}

Property changes on: tmp/org.txm.core/src/java/org/txm/core/engines/ImportEngines.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.core/src/java/org/txm/objects/Project.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/objects/Project.java	(revision 1074)
+++ tmp/org.txm.core/src/java/org/txm/objects/Project.java	(revision 1075)
@@ -46,6 +46,8 @@
 import javax.xml.transform.stream.StreamResult;
 
 import org.eclipse.core.runtime.IProgressMonitor;
+import org.txm.Toolbox;
+import org.txm.core.engines.EngineType;
 import org.txm.core.messages.TXMCoreMessages;
 import org.txm.core.results.TXMResult;
 import org.txm.utils.logger.Log;
Index: tmp/org.txm.core/schema/org.txm.core.engines.ImportEngine.exsd
===================================================================
--- tmp/org.txm.core/schema/org.txm.core.engines.ImportEngine.exsd	(revision 0)
+++ tmp/org.txm.core/schema/org.txm.core.engines.ImportEngine.exsd	(revision 1075)
@@ -0,0 +1,109 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.txm.core" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+      <appinfo>
+         <meta.schema plugin="org.txm.core" id="org.txm.core.engines.ImportEngine" name="org.txm.core.engines.ImportEngine"/>
+      </appinfo>
+      <documentation>
+         [Enter description of this extension point.]
+      </documentation>
+   </annotation>
+
+   <element name="extension">
+      <annotation>
+         <appinfo>
+            <meta.element />
+         </appinfo>
+      </annotation>
+      <complexType>
+         <choice minOccurs="1" maxOccurs="unbounded">
+            <element ref="ImportEngine"/>
+         </choice>
+         <attribute name="point" type="string" use="required">
+            <annotation>
+               <documentation>
+                  
+               </documentation>
+            </annotation>
+         </attribute>
+         <attribute name="id" type="string">
+            <annotation>
+               <documentation>
+                  
+               </documentation>
+            </annotation>
+         </attribute>
+         <attribute name="name" type="string">
+            <annotation>
+               <documentation>
+                  
+               </documentation>
+               <appinfo>
+                  <meta.attribute translatable="true"/>
+               </appinfo>
+            </annotation>
+         </attribute>
+      </complexType>
+   </element>
+
+   <element name="ImportEngine">
+      <complexType>
+         <attribute name="class" type="string" use="required">
+            <annotation>
+               <documentation>
+                  
+               </documentation>
+               <appinfo>
+                  <meta.attribute kind="java" basedOn="org.txm.core.engines.ImportEngine:"/>
+               </appinfo>
+            </annotation>
+         </attribute>
+         <attribute name="name" type="string" use="required">
+            <annotation>
+               <documentation>
+                  
+               </documentation>
+            </annotation>
+         </attribute>
+      </complexType>
+   </element>
+
+   <annotation>
+      <appinfo>
+         <meta.section type="since"/>
+      </appinfo>
+      <documentation>
+         [Enter the first release in which this extension point appears.]
+      </documentation>
+   </annotation>
+
+   <annotation>
+      <appinfo>
+         <meta.section type="examples"/>
+      </appinfo>
+      <documentation>
+         [Enter extension point usage example here.]
+      </documentation>
+   </annotation>
+
+   <annotation>
+      <appinfo>
+         <meta.section type="apiinfo"/>
+      </appinfo>
+      <documentation>
+         [Enter API information here.]
+      </documentation>
+   </annotation>
+
+   <annotation>
+      <appinfo>
+         <meta.section type="implementation"/>
+      </appinfo>
+      <documentation>
+         [Enter information about supplied implementation of this extension point.]
+      </documentation>
+   </annotation>
+
+
+</schema>

Property changes on: tmp/org.txm.core/schema/org.txm.core.engines.ImportEngine.exsd
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.libs.office/.classpath
===================================================================
--- tmp/org.txm.libs.office/.classpath	(revision 1074)
+++ tmp/org.txm.libs.office/.classpath	(revision 1075)
@@ -9,7 +9,7 @@
 	<classpathentry exported="true" kind="lib" path="lib/commons-logging-1.2.jar"/>
 	<classpathentry exported="true" kind="lib" path="lib/commons-validator-1.5.0.jar"/>
 	<classpathentry exported="true" kind="lib" path="lib/java-rdfa-0.4.2.jar"/>
-	<classpathentry exported="true" kind="lib" path="lib/jena-core-2.11.2.jar"/>
+	<classpathentry exported="true" kind="lib" path="lib/jena-core-2.11.2.jar" sourcepath="/home/mdecorde/.m2/repository/org/apache/jena/jena-core/2.11.2/jena-core-2.11.2-sources.jar"/>
 	<classpathentry exported="true" kind="lib" path="lib/jena-iri-1.0.2.jar"/>
 	<classpathentry exported="true" kind="lib" path="lib/junit-3.8.1.jar"/>
 	<classpathentry exported="true" kind="lib" path="lib/log4j-1.2.17.jar"/>
Index: tmp/org.txm.index.rcp/src/org/txm/index/rcp/editors/IndexEditor.java
===================================================================
--- tmp/org.txm.index.rcp/src/org/txm/index/rcp/editors/IndexEditor.java	(revision 1074)
+++ tmp/org.txm.index.rcp/src/org/txm/index/rcp/editors/IndexEditor.java	(revision 1075)
@@ -62,10 +62,12 @@
 import org.txm.rcp.editors.listeners.ComputeSelectionListener;
 import org.txm.rcp.messages.TXMUIMessages;
 import org.txm.rcp.swt.GLComposite;
+import org.txm.rcp.swt.widget.AssistedChoiceQueryWidget;
 import org.txm.rcp.swt.widget.AssistedQueryWidget;
 import org.txm.rcp.swt.widget.NavigationWidget;
 import org.txm.rcp.swt.widget.PropertiesSelector;
 import org.txm.rcp.views.QueriesView;
+import org.txm.searchengine.core.Query;
 import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
 import org.txm.searchengine.cqp.corpus.Corpus;
 import org.txm.searchengine.cqp.corpus.Property;
@@ -123,11 +125,9 @@
 	/** The title. */
 	String title;
 
-	
-	
 	/** The query widget. */
 	@Parameter(key=TXMPreferences.QUERY)
-	protected AssistedQueryWidget queryWidget;
+	protected AssistedChoiceQueryWidget queryWidget;
 
 	/** The Fmin spinner. */
 	@Parameter(key=TXMPreferences.F_MIN)
@@ -200,7 +200,7 @@
 		queryLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, true));
 
 		// [ (v)]
-		queryWidget = new AssistedQueryWidget(getMainParametersComposite(), SWT.DROP_DOWN,	index.getCorpus());
+		queryWidget = new AssistedChoiceQueryWidget(getMainParametersComposite(), SWT.DROP_DOWN,	index.getCorpus());
 		GridData layoutData = new GridData(GridData.VERTICAL_ALIGN_CENTER);
 		layoutData.horizontalAlignment = GridData.FILL;
 		layoutData.grabExcessHorizontalSpace = true;
@@ -623,7 +623,7 @@
 		this.queryWidget.setText(query);
 	}
 
-	public CQLQuery getQuery() {
+	public Query getQuery() {
 		return queryWidget.getQuery();
 	}
 }
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 1074)
+++ tmp/org.txm.index.core/src/org/txm/index/core/functions/Index.java	(revision 1075)
@@ -49,6 +49,7 @@
 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.searchengine.core.Query;
 import org.txm.searchengine.cqp.CQPSearchEngine;
 import org.txm.searchengine.cqp.ICqiClient;
 import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
@@ -132,7 +133,7 @@
 	 * The CQP query.
 	 */
 	@Parameter(key=TBXPreferences.QUERY)
-	protected CQLQuery pQuery;
+	protected Query pQuery;
 	
 	/**
 	 * The line index of the current index page.
@@ -786,7 +787,7 @@
 	 *
 	 * @return the query used
 	 */
-	public CQLQuery getQuery() {
+	public Query getQuery() {
 		return pQuery;
 	}
 
@@ -859,11 +860,16 @@
 	 * @throws CqiServerError 
 	 * @throws IOException 
 	 */
-	protected boolean scanCorpus(Corpus corpus) throws CqiClientException, IOException, CqiServerError {
+	protected boolean scanCorpus(Corpus corpus) throws Exception {
 		// get the cqp result of the query
 
 		//long time = System.currentTimeMillis();
-		QueryResult result = corpus.query(pQuery, "index", true); //$NON-NLS-1$
+		QueryResult result = null;
+		if (pQuery instanceof CQLQuery) {
+			result = corpus.query((CQLQuery)pQuery, "index", true); //$NON-NLS-1$
+		} else {
+			pQuery.getSearchEngine().query(corpus, pQuery, "index", true); //$NON-NLS-1$
+		}
 		boolean isTargetUsed = CQPSearchEngine.getCqiClient().subCorpusHasField(result.getQualifiedCqpId(), ICqiClient.CQI_CONST_FIELD_TARGET);
 		int nbresults = result.getNMatch();
 		this.nTotalTokens += nbresults; // get number of tokens
Index: tmp/org.txm.searchengine.core/src/org/txm/searchengine/core/EmptySelection.java
===================================================================
--- tmp/org.txm.searchengine.core/src/org/txm/searchengine/core/EmptySelection.java	(revision 0)
+++ tmp/org.txm.searchengine.core/src/org/txm/searchengine/core/EmptySelection.java	(revision 1075)
@@ -0,0 +1,30 @@
+package org.txm.searchengine.core;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class EmptySelection extends Selection {
+	
+	private static final List<? extends Match> EMPTY = new ArrayList<Match>();
+	protected Query query;
+	
+	public EmptySelection(Query query) {
+		this.query = query;
+	}
+
+	public List<? extends Match> getMatches() {
+		return EMPTY;
+	}
+	
+	public List<? extends Match> getMatches(int from, int to) {
+		return EMPTY;
+	}
+	
+	public int getNMatch() {
+		return 0;
+	}
+	
+	public Query getQuery() {
+		return query;
+	}
+}

Property changes on: tmp/org.txm.searchengine.core/src/org/txm/searchengine/core/EmptySelection.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.searchengine.core/src/org/txm/searchengine/core/Query.java
===================================================================
--- tmp/org.txm.searchengine.core/src/org/txm/searchengine/core/Query.java	(revision 1074)
+++ tmp/org.txm.searchengine.core/src/org/txm/searchengine/core/Query.java	(revision 1075)
@@ -11,5 +11,25 @@
 	public String getQueryString();
 	
 	public boolean isEmpty();
+
+	/**
+	 * 
+	 * @return the Query SearchEngine that can resolve the query
+	 */
+	public SearchEngine getSearchEngine();
+
+	/**
+	 * update the query
+	 * 
+	 * @param rawQuery
+	 * @return this
+	 */
+	public Query setQuery(String rawQuery);
 	
+	/**
+	 * fix the query using sugar syntax rules
+	 * @return this
+	 */
+	public Query fixQuery();
+	
 }
Index: tmp/org.txm.searchengine.core/src/org/txm/searchengine/core/Selection.java
===================================================================
--- tmp/org.txm.searchengine.core/src/org/txm/searchengine/core/Selection.java	(revision 0)
+++ tmp/org.txm.searchengine.core/src/org/txm/searchengine/core/Selection.java	(revision 1075)
@@ -0,0 +1,16 @@
+package org.txm.searchengine.core;
+
+import java.util.List;
+
+public abstract class Selection {
+	
+
+
+	public abstract List<? extends Match> getMatches() throws Exception;
+	
+	public abstract List<? extends Match> getMatches(int from, int to) throws Exception;
+	
+	public abstract int getNMatch() throws Exception;
+	
+	public abstract Query getQuery();
+}

Property changes on: tmp/org.txm.searchengine.core/src/org/txm/searchengine/core/Selection.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.searchengine.core/src/org/txm/searchengine/core/SearchEnginesManager.java
===================================================================
--- tmp/org.txm.searchengine.core/src/org/txm/searchengine/core/SearchEnginesManager.java	(revision 1074)
+++ tmp/org.txm.searchengine.core/src/org/txm/searchengine/core/SearchEnginesManager.java	(revision 1075)
@@ -1,8 +1,12 @@
 package org.txm.searchengine.core;
 
+import java.util.ArrayList;
+import java.util.List;
+
 import org.txm.Toolbox;
 import org.txm.core.engines.EngineType;
 import org.txm.core.engines.EnginesManager;
+import org.txm.objects.CorpusBuild;
 
 /**
  * Search engines manager.
@@ -38,4 +42,15 @@
 		return EngineType.SEARCH;
 	}
 
+	public static List<SearchEngine> getAvailableEngines(CorpusBuild corpus) {
+		List<SearchEngine> availables = new ArrayList<SearchEngine>();
+		SearchEnginesManager em = (SearchEnginesManager) Toolbox.getEngineManager(EngineType.SEARCH);
+		for (String name : em.getEngines().keySet()) {
+			SearchEngine engine = em.getEngine(name);
+			if (engine.hasIndexes(corpus)) {
+				availables.add(engine);
+			}
+		}
+		return availables;
+	}
 }
Index: tmp/org.txm.searchengine.core/src/org/txm/searchengine/core/SearchEngine.java
===================================================================
--- tmp/org.txm.searchengine.core/src/org/txm/searchengine/core/SearchEngine.java	(revision 1074)
+++ tmp/org.txm.searchengine.core/src/org/txm/searchengine/core/SearchEngine.java	(revision 1075)
@@ -1,6 +1,7 @@
 package org.txm.searchengine.core;
 
 import org.txm.core.engines.Engine;
+import org.txm.objects.CorpusBuild;
 
 // FIXME: useless class
 public abstract class SearchEngine implements Engine {
@@ -9,4 +10,15 @@
 
 	@Override
 	public abstract String getName();
+	
+	public abstract Selection query(CorpusBuild corpus, Query query, String name, boolean saveQuery) throws Exception;
+	
+	public abstract Query newQuery();
+
+	/**
+	 * 
+	 * @param corpus
+	 * @return true if the Engine can query the corpus
+	 */
+	public abstract boolean hasIndexes(CorpusBuild corpus);
 }
Index: tmp/org.txm.searchengine.core/src/org/txm/searchengine/core/corpus/CorpusSearchException.java
===================================================================
--- tmp/org.txm.searchengine.core/src/org/txm/searchengine/core/corpus/CorpusSearchException.java	(revision 0)
+++ tmp/org.txm.searchengine.core/src/org/txm/searchengine/core/corpus/CorpusSearchException.java	(revision 1075)
@@ -0,0 +1,17 @@
+package org.txm.searchengine.core.corpus;
+
+public class CorpusSearchException extends Exception {
+
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = 3518861723206508596L;
+
+	public CorpusSearchException(String message) {
+		super(message);
+	}
+
+	public CorpusSearchException(String message, Throwable cause) {
+		super(message, cause);
+	}
+}

Property changes on: tmp/org.txm.searchengine.core/src/org/txm/searchengine/core/corpus/CorpusSearchException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.searchengine.core/src/org/txm/searchengine/core/Match.java
===================================================================
--- tmp/org.txm.searchengine.core/src/org/txm/searchengine/core/Match.java	(revision 0)
+++ tmp/org.txm.searchengine.core/src/org/txm/searchengine/core/Match.java	(revision 1075)
@@ -0,0 +1,62 @@
+package org.txm.searchengine.core;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public abstract class Match implements Comparable<Match> {
+	public abstract int getStart();
+	public abstract int getEnd();
+	public abstract int getTarget();
+	
+	public boolean contains(Match m) {
+		return (this.getStart() <= m.getStart() && m.getEnd() <= this.getEnd());
+	}
+	
+	/* (non-Javadoc)
+	 * @see java.lang.Comparable#compareTo(java.lang.Object)
+	 */
+	@Override
+	public int compareTo(Match m) {
+
+		if (m == null)
+			return -1;
+		if (this.getStart() < m.getStart())
+			return -1;
+		else if (this.getStart() > m.getStart())
+			return 1;
+		else if (this.getEnd() < m.getEnd())
+			return -1;
+		else
+			return 1;
+
+	}
+
+	/* (non-Javadoc)
+	 * @see java.lang.Object#toString()
+	 */
+	@Override
+	public String toString() {
+		return "<" + this.getStart() + ", " + this.getEnd() + ">"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+	}
+	
+	/**
+	 * Size.
+	 *
+	 * @return the int
+	 */
+	public int size() {
+		return getEnd() - getStart() + 1;
+	}
+	
+	public List<Integer> getRange() {
+		List<Integer> ret = new ArrayList<Integer>(size());
+		for (int i = getStart() ; i <= getEnd(); i++) ret.add(i);
+		return ret;
+	}
+
+	public abstract void setEnd(int p);
+
+	public abstract void setStart(int p);
+	
+	public abstract void setTarget(int p);
+}

Property changes on: tmp/org.txm.searchengine.core/src/org/txm/searchengine/core/Match.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.progression.rcp/src/org/txm/progression/rcp/editors/ProgressionEditor.java
===================================================================
--- tmp/org.txm.progression.rcp/src/org/txm/progression/rcp/editors/ProgressionEditor.java	(revision 1074)
+++ tmp/org.txm.progression.rcp/src/org/txm/progression/rcp/editors/ProgressionEditor.java	(revision 1075)
@@ -43,6 +43,7 @@
 import org.txm.rcp.swt.widget.structures.StructuralUnitPropertiesComboViewer;
 import org.txm.rcp.swt.widget.structures.StructuralUnitsComboViewer;
 import org.txm.rcp.swt.widget.structures.StructuralUnitsCombosGroup;
+import org.txm.searchengine.core.Query;
 import org.txm.searchengine.cqp.corpus.query.CQLQuery;
 import org.txm.utils.io.IOUtils;
 import org.txm.utils.logger.Log;
@@ -95,7 +96,7 @@
 	 * Queries.
 	 */
 	@Parameter(key=ProgressionPreferences.QUERIES)
-	protected List<CQLQuery> queryList;
+	protected List<Query> queryList;
 
 	/**
 	 * Structural unit.
@@ -520,7 +521,7 @@
 			assistedQueryWidget.setText(query);
 		}
 
-		public CQLQuery getQuery() {
+		public Query getQuery() {
 			return assistedQueryWidget.getQuery();
 		}
 
@@ -599,7 +600,7 @@
 
 		 // initialize query fields
 		if (queryWidgets.size() == 0 && queryList != null) {
-			for (CQLQuery q : queryList) {
+			for (Query q : queryList) {
 				addFocusQueryField(q.getQueryString()); 
 			}
 		}
@@ -614,7 +615,7 @@
 	public void updateResultFromEditor() {
 
 		// create query list from widget
-		queryList = new ArrayList<CQLQuery>();
+		queryList = new ArrayList<Query>();
 		for (QueryField wid : queryWidgets) {
 			if (!wid.getQuery().isEmpty()) {
 				queryList.add(wid.getQuery());
Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/editors/TXMEditor.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/editors/TXMEditor.java	(revision 1074)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/editors/TXMEditor.java	(revision 1075)
@@ -64,6 +64,7 @@
 import org.txm.rcp.handlers.BaseAbstractHandler;
 import org.txm.rcp.messages.TXMUIMessages;
 import org.txm.rcp.swt.GLComposite;
+import org.txm.rcp.swt.widget.AssistedChoiceQueryWidget;
 import org.txm.rcp.swt.widget.AssistedQueryWidget;
 import org.txm.rcp.swt.widget.FloatSpinner;
 import org.txm.rcp.swt.widget.NewNavigationWidget;
@@ -73,6 +74,7 @@
 import org.txm.rcp.utils.SWTEditorsUtils;
 import org.txm.rcp.views.corpora.CorporaView;
 import org.txm.rcp.views.debug.TXMResultDebugView;
+import org.txm.searchengine.core.Query;
 import org.txm.searchengine.cqp.ReferencePattern;
 import org.txm.searchengine.cqp.corpus.Property;
 import org.txm.searchengine.cqp.corpus.query.CQLQuery;
@@ -885,6 +887,16 @@
 						((AssistedQueryWidget)object).setText(((CQLQuery)value).getQueryString());
 					}
 				}
+				else if(object instanceof AssistedChoiceQueryWidget)	{
+					if(!((Query)value).getQueryString().isEmpty())	{
+						((QueryWidget)object).setText(((Query)value).getQueryString());
+					}
+				}
+				else if(object instanceof AssistedQueryWidget)	{
+					if(!((CQLQuery)value).getQueryString().isEmpty())	{
+						((QueryWidget)object).setText(((CQLQuery)value).getQueryString());
+					}
+				}
 				else if(object instanceof QueryWidget)	{
 					if(!((CQLQuery)value).getQueryString().isEmpty())	{
 						((QueryWidget)object).setText(((CQLQuery)value).getQueryString());
@@ -987,6 +999,9 @@
 				else if(object instanceof NewNavigationWidget)	{
 					value = ((NewNavigationWidget)object).getCurrentPosition(); 
 				}
+				else if(object instanceof AssistedChoiceQueryWidget)	{
+					value = ((AssistedChoiceQueryWidget)object).getQuery();
+				}
 				else if(object instanceof AssistedQueryWidget)	{
 					value = ((AssistedQueryWidget)object).getQuery();
 				}
Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/swt/widget/AssistedQueryWidget.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/swt/widget/AssistedQueryWidget.java	(revision 1074)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/swt/widget/AssistedQueryWidget.java	(revision 1075)
@@ -33,15 +33,16 @@
 import org.eclipse.swt.events.SelectionEvent;
 import org.eclipse.swt.events.SelectionListener;
 import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
 import org.eclipse.swt.widgets.Button;
 import org.eclipse.swt.widgets.Composite;
 import org.txm.rcp.IImageKeys;
 import org.txm.rcp.messages.TXMUIMessages;
 import org.txm.rcp.swt.GLComposite;
 import org.txm.rcp.swt.dialog.QueryAssistDialog;
+import org.txm.searchengine.core.Query;
+import org.txm.searchengine.core.SearchEngine;
+import org.txm.searchengine.core.SearchEnginesManager;
 import org.txm.searchengine.cqp.corpus.Corpus;
-import org.txm.searchengine.cqp.corpus.query.CQLQuery;
 // TODO: Auto-generated Javadoc
 /**
  * the QueryWidget plus the button to open the QueryAssisDialog @ author
@@ -49,6 +50,8 @@
  */
 public class AssistedQueryWidget extends Composite {
 	
+	protected SearchEngine se;
+	
 	/** The magicstick button: opens the QueryAssist dialog. */
 	protected Button magicstick;
 	
@@ -64,10 +67,12 @@
 	 * @param style the style
 	 * @param corpus the corpus
 	 */
-	public AssistedQueryWidget(Composite parent, int style, final Corpus corpus) {
+	public AssistedQueryWidget(Composite parent, int style, final Corpus corpus, SearchEngine se) {
 		super(parent, SWT.NONE);
 		this.setLayout(GLComposite.createDefaultLayout(2));
 
+		this.se = se;
+		
 		magicstick = new Button(this, SWT.PUSH);
 		magicstick.setLayoutData(new GridData(GridData.FILL, GridData.CENTER,
 				false, false));
@@ -86,10 +91,14 @@
 			public void widgetDefaultSelected(SelectionEvent e) { }
 		});
 
-		querywidget = new QueryWidget(this, style);
+		querywidget = new QueryWidget(this, style, se);
 		querywidget.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false));
 	}
 	
+	public AssistedQueryWidget(Composite parent, int style, Corpus corpus) {
+		this(parent, style, corpus, SearchEnginesManager.getCQPSearchEngine());
+	}
+
 	public boolean setFocus() {
 		return this.querywidget.setFocus();
 	}
@@ -158,7 +167,7 @@
 		querywidget.setText(query);
 	}
 
-	public CQLQuery getQuery() {
+	public Query getQuery() {
 		return this.querywidget.getQuery();
 	}
 }
Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/swt/widget/QueryWidget.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/swt/widget/QueryWidget.java	(revision 1074)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/swt/widget/QueryWidget.java	(revision 1075)
@@ -32,7 +32,10 @@
 
 import org.eclipse.swt.widgets.Combo;
 import org.eclipse.swt.widgets.Composite;
-import org.txm.searchengine.cqp.corpus.query.CQLQuery;
+import org.txm.searchengine.core.Query;
+import org.txm.searchengine.core.SearchEngine;
+import org.txm.searchengine.core.SearchEnginesManager;
+import org.txm.searchengine.cqp.corpus.Corpus;
 
 // TODO: Auto-generated Javadoc
 /**
@@ -45,6 +48,8 @@
  */
 public class QueryWidget extends Combo {
 
+	SearchEngine se;
+	
 	/** The history. */
 	private static Deque<String> history = new LinkedList<String>();
 
@@ -54,11 +59,20 @@
 	 * @param parent the parent
 	 * @param style the style
 	 */
-	public QueryWidget(Composite parent, int style) {
+	public QueryWidget(Composite parent, int style, SearchEngine se) {
 		super(parent, style);
+		this.se = se;
 		this.setItems(history.toArray(new String[history.size()]));
 	}
+	
+	public QueryWidget(Composite composite, int style) {
+		this(composite, style, SearchEnginesManager.getCQPSearchEngine());
+	}
 
+	public void setSearchEngine(SearchEngine se) {
+		this.se = se;
+	}
+
 	/**
 	 * Gets the CQP query string inferred from the user input.
 	 *
@@ -72,7 +86,7 @@
 		else {
 			rawQuery = this.getItem(this.getSelectionIndex());
 		}
-		return CQLQuery.fixQuery(rawQuery);
+		return se.newQuery().setQuery(rawQuery).fixQuery().getQueryString();
 	}
 
 	/**
@@ -116,11 +130,10 @@
 	 *
 	 * @return the query
 	 */
-	public CQLQuery getQuery() {
-		if(!this.getQueryString().isEmpty())	{
-			return new CQLQuery(this.getQueryString());	
-		}
-		else	{
+	public Query getQuery() {
+		if (!this.getQueryString().isEmpty())	{
+			return se.newQuery().setQuery(this.getQueryString());	
+		} else {
 			return null;
 		}
 	};
Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/swt/widget/parameters/QueryField.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/swt/widget/parameters/QueryField.java	(revision 1074)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/swt/widget/parameters/QueryField.java	(revision 1075)
@@ -7,6 +7,7 @@
 import org.eclipse.swt.widgets.Label;
 import org.kohsuke.args4j.NamedOptionDef;
 import org.txm.rcp.swt.widget.QueryWidget;
+import org.txm.searchengine.core.Query;
 import org.txm.searchengine.cqp.corpus.query.CQLQuery;
 
 public class QueryField extends ParameterField {
@@ -30,7 +31,7 @@
 		resetToDefault();
 	}
 
-	public CQLQuery getWidgetValue() {
+	public Query getWidgetValue() {
 		return w.getQuery();
 	}
 
Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/swt/widget/AssistedChoiceQueryWidget.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/swt/widget/AssistedChoiceQueryWidget.java	(revision 0)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/swt/widget/AssistedChoiceQueryWidget.java	(revision 1075)
@@ -0,0 +1,214 @@
+// Copyright © 2010-2013 ENS de Lyon.
+// Copyright © 2007-2010 ENS de Lyon, CNRS, INRP, University of
+// Lyon 2, University of Franche-Comté, University of Nice
+// Sophia Antipolis, University of Paris 3.
+// 
+// The TXM platform is free software: you can redistribute it
+// and/or modify it under the terms of the GNU General Public
+// License as published by the Free Software Foundation,
+// either version 2 of the License, or (at your option) any
+// later version.
+// 
+// The TXM platform is distributed in the hope that it will be
+// useful, but WITHOUT ANY WARRANTY; without even the implied
+// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+// PURPOSE. See the GNU General Public License for more
+// details.
+// 
+// You should have received a copy of the GNU General
+// Public License along with the TXM platform. If not, see
+// http://www.gnu.org/licenses.
+// 
+// 
+// 
+// $LastChangedDate:$
+// $LastChangedRevision:$
+// $LastChangedBy:$ 
+//
+package org.txm.rcp.swt.widget;
+
+import java.util.List;
+
+import org.eclipse.jface.viewers.ComboViewer;
+import org.eclipse.jface.viewers.IBaseLabelProvider;
+import org.eclipse.jface.viewers.ILabelProviderListener;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.window.Window;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.KeyListener;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.txm.rcp.IImageKeys;
+import org.txm.rcp.messages.TXMUIMessages;
+import org.txm.rcp.swt.GLComposite;
+import org.txm.rcp.swt.dialog.QueryAssistDialog;
+import org.txm.rcp.swt.provider.ListContentProvider;
+import org.txm.rcp.swt.provider.SimpleLabelProvider;
+import org.txm.searchengine.core.Query;
+import org.txm.searchengine.core.SearchEngine;
+import org.txm.searchengine.core.SearchEnginesManager;
+import org.txm.searchengine.cqp.corpus.Corpus;
+import org.txm.searchengine.cqp.corpus.query.CQLQuery;
+
+/**
+ * the QueryWidget 
+ * 	+ the button to open the QueryAssisDialog
+ *  + Engine selector 
+ * 
+ * @author mdecorde.
+ */
+public class AssistedChoiceQueryWidget extends Composite {
+
+	/** The magicstick button: opens the QueryAssist dialog. */
+	protected Button magicstick;
+
+	/** The querywidget. */
+	protected QueryWidget querywidget;
+
+	private QueryAssistDialog d;
+
+	/**
+	 * Instantiates a new assisted query widget.
+	 *
+	 * @param parent the parent
+	 * @param style the style
+	 * @param corpus the corpus
+	 */
+	public AssistedChoiceQueryWidget(Composite parent, int style, final Corpus corpus) {
+		super(parent, SWT.NONE);
+		this.setLayout(GLComposite.createDefaultLayout(3));
+
+		List<SearchEngine> engines = SearchEnginesManager.getAvailableEngines(corpus);
+
+		//if (engines.size() > 1) {
+			ComboViewer combo = new ComboViewer(this);
+			Combo ccombo = combo.getCombo();
+			combo.setContentProvider(new ListContentProvider());
+			ccombo.setLayoutData(new GridData(GridData.FILL, GridData.CENTER,
+					false, false));
+			combo.setLabelProvider(new LabelProvider() {
+				@Override
+				public String getText(Object element) {
+					return ((SearchEngine)element).getName();
+				}
+			});
+			combo.setInput(engines);
+			ccombo.select(0);
+			combo.addSelectionChangedListener(new ISelectionChangedListener() {
+				
+				@Override
+				public void selectionChanged(SelectionChangedEvent event) {
+					ISelection isel = event.getSelection();
+					StructuredSelection sel = (StructuredSelection)isel;
+					Object o = sel.getFirstElement();
+					SearchEngine se = (SearchEngine)o;
+					querywidget.setSearchEngine(se);
+				}
+			});
+		//}
+
+		magicstick = new Button(this, SWT.PUSH);
+		magicstick.setLayoutData(new GridData(GridData.FILL, GridData.CENTER,
+				false, false));
+		magicstick.setImage(IImageKeys.getImage(IImageKeys.ACTION_ASSISTQUERY));
+		magicstick.setToolTipText(TXMUIMessages.AssistedQueryWidget_0);
+		magicstick.addSelectionListener(new SelectionListener() {
+			@Override
+			public void widgetSelected(SelectionEvent e) {
+				d = new QueryAssistDialog(e.display.getActiveShell(), corpus);
+				if (d.open() == Window.OK) {
+					querywidget.setText(d.getQuery());
+				}
+			}
+
+			@Override
+			public void widgetDefaultSelected(SelectionEvent e) { }
+		});
+
+		for (SearchEngine engine : engines) {
+			querywidget = new QueryWidget(this, style, engine);
+			querywidget.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false));
+			break; // set the first engine as default engine
+		}
+	}
+
+	public boolean setFocus() {
+		return this.querywidget.setFocus();
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.swt.widgets.Control#addKeyListener(org.eclipse.swt.events.KeyListener)
+	 */
+	@Override
+	public void addKeyListener(KeyListener listener) {
+		if (querywidget != null)
+			this.querywidget.addKeyListener(listener);
+	}
+
+	/**
+	 * Gets the query string.
+	 *
+	 * @return the query string
+	 */
+	public String getQueryString() {
+		return querywidget.getQueryString();
+	}
+
+	/**
+	 * Gets the query string.
+	 *
+	 * @return the query string
+	 */
+	public String getRawString() {
+		return querywidget.getText();
+	}
+
+	/**
+	 * Memorize.
+	 */
+	public void memorize() {
+		querywidget.memorize();
+	}
+
+	/**
+	 * Memorize.
+	 *
+	 * @param query the query
+	 */
+	public void memorize(String query) {
+		querywidget.memorize(query);
+	}
+
+	/**
+	 * Clears the query test.
+	 */
+	public void clearQuery()	{
+		this.querywidget.setText(""); //$NON-NLS-1$
+	}
+
+	/**
+	 * Sets the text.
+	 *
+	 * @param query the new text
+	 */
+	public void setText(String query) {
+
+		//		if(query.isEmpty())	{
+		//			query = ""; //$NON-NLS-1$
+		//		}
+
+		querywidget.setText(query);
+	}
+
+	public Query getQuery() {
+		return this.querywidget.getQuery();
+	}
+}

Property changes on: tmp/org.txm.rcp/src/main/java/org/txm/rcp/swt/widget/AssistedChoiceQueryWidget.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.textsbalance.core/src/org/txm/textsbalance/core/functions/TextsBalance.java
===================================================================
--- tmp/org.txm.textsbalance.core/src/org/txm/textsbalance/core/functions/TextsBalance.java	(revision 1074)
+++ tmp/org.txm.textsbalance.core/src/org/txm/textsbalance/core/functions/TextsBalance.java	(revision 1075)
@@ -148,7 +148,7 @@
 						QueryResult r = this.getCorpus().query(new CQLQuery("[_."+p.getFullName()+"=\""+value+"\"] expand to text"), "tmp", false);
 						int t = 0;
 						for (Match m : r.getMatches()) {
-							t += m.getLength();
+							t += m.size();
 						}
 						v = t;
 						r.drop();
@@ -204,7 +204,7 @@
 						if (!interUniq.containsKey(o)) {
 							interUniq.put(o, 0);
 						}
-						int s = supLimits.get(inter.get(iMatch)).getLength();
+						int s = supLimits.get(inter.get(iMatch)).size();
 						interUniq.put(o, interUniq.get(o) + s);
 
 					}
Index: tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/QueryResult.java
===================================================================
--- tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/QueryResult.java	(revision 1074)
+++ tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/QueryResult.java	(revision 1075)
@@ -32,6 +32,7 @@
 import java.util.List;
 
 import org.txm.core.messages.TXMCoreMessages;
+import org.txm.searchengine.core.Selection;
 import org.txm.searchengine.cqp.AbstractCqiClient;
 import org.txm.searchengine.cqp.NetCqiClient;
 import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
@@ -46,7 +47,7 @@
  * 
  * @author jmague
  */
-public class QueryResult implements CqpObject {
+public class QueryResult extends Selection implements CqpObject {
 
 	/** The cqp id. */
 	protected String cqpId;
Index: tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/query/Match.java
===================================================================
--- tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/query/Match.java	(revision 1074)
+++ tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/query/Match.java	(revision 1075)
@@ -29,10 +29,8 @@
 
 import java.util.ArrayList;
 import java.util.Arrays;
-import java.util.Collection;
 import java.util.List;
 
-import org.apache.commons.lang.math.IntRange;
 import org.txm.searchengine.cqp.AbstractCqiClient;
 import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
 import org.txm.searchengine.cqp.corpus.CorpusManager;
@@ -44,7 +42,7 @@
  * 
  * @author jmague, mdecorde
  */
-public class Match implements Comparable<Match> {
+public class Match extends org.txm.searchengine.core.Match {
 
 	/** The start. */
 	private int start;
@@ -103,10 +101,6 @@
 	public int getEnd() {
 		return end;
 	}
-	
-	public boolean contains(Match m) {
-		return (this.start <= m.start && m.end <= this.end);
-	}
 
 //	/**
 //	 * Gets the query result.
@@ -207,33 +201,6 @@
 
 	}
 
-	/* (non-Javadoc)
-	 * @see java.lang.Comparable#compareTo(java.lang.Object)
-	 */
-	@Override
-	public int compareTo(Match m) {
-
-		if (m == null)
-			return -1;
-		if (this.start < m.start)
-			return -1;
-		else if (this.start > m.start)
-			return 1;
-		else if (this.end < m.end)
-			return -1;
-		else
-			return 1;
-
-	}
-
-	/* (non-Javadoc)
-	 * @see java.lang.Object#toString()
-	 */
-	@Override
-	public String toString() {
-		return "<" + start + ", " + end + ">"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-	}
-
 	/**
 	 * Gets the ids.
 	 *
@@ -261,25 +228,6 @@
 		}
 	}
 
-	/**
-	 * Size.
-	 *
-	 * @return the int
-	 */
-	public int size() {
-		return end - start + 1;
-	}
-	
-	public int getLength() {
-		return (end - start);
-	}
-
-	public List<Integer> getRange() {
-		List<Integer> ret = new ArrayList<Integer>(size());
-		for (int i = start ; i <= end; i++) ret.add(i);
-		return ret;
-	}
-
 	public void setEnd(int p) {
 		this.end = p;
 	}
@@ -287,4 +235,9 @@
 	public void setStart(int p) {
 		this.start = p;
 	}
+
+	@Override
+	public void setTarget(int p) {
+		this.target = p;
+	}
 }
Index: tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/query/CQLQuery.java
===================================================================
--- tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/query/CQLQuery.java	(revision 1074)
+++ tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/query/CQLQuery.java	(revision 1075)
@@ -34,6 +34,9 @@
 
 import org.txm.core.preferences.TXMPreferences;
 import org.txm.searchengine.core.Query;
+import org.txm.searchengine.core.SearchEngine;
+import org.txm.searchengine.core.SearchEnginesManager;
+import org.txm.searchengine.cqp.CQPSearchEngine;
 
 /**
  * Implements a CQL query. Use fixQuery to use query sugar.
@@ -383,4 +386,21 @@
 		String test = "^$sdf<>sdf|\\sdf\"{(sdf)}?+sdf*."; //$NON-NLS-1$
 		System.out.println(CQLQuery.addBackSlash(test));
 	}
+
+	@Override
+	public SearchEngine getSearchEngine() {
+		return SearchEnginesManager.getCQPSearchEngine();
+	}
+
+	@Override
+	public Query setQuery(String rawQuery) {
+		this.queryString = rawQuery;
+		return this;
+	}
+
+	@Override
+	public Query fixQuery() {
+		this.queryString = fixQuery(this.queryString);
+		return this;
+	}
 }
Index: tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/CQPSearchEngine.java
===================================================================
--- tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/CQPSearchEngine.java	(revision 1074)
+++ tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/CQPSearchEngine.java	(revision 1075)
@@ -15,11 +15,20 @@
 import org.txm.core.preferences.TXMPreferences;
 import org.txm.importer.cwb.PatchCwbRegistry;
 import org.txm.libs.cqp.CQPLibPreferences;
+import org.txm.objects.CorpusBuild;
 import org.txm.objects.Project;
+import org.txm.searchengine.core.EmptySelection;
+import org.txm.searchengine.core.Query;
 import org.txm.searchengine.core.SearchEngine;
+import org.txm.searchengine.core.Selection;
+import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
+import org.txm.searchengine.cqp.clientExceptions.InvalidCqpIdException;
 import org.txm.searchengine.cqp.clientExceptions.ServerNotFoundException;
+import org.txm.searchengine.cqp.corpus.CQPCorpus;
+import org.txm.searchengine.cqp.corpus.Corpus;
 import org.txm.searchengine.cqp.corpus.CorpusManager;
 import org.txm.searchengine.cqp.corpus.MainCorpus;
+import org.txm.searchengine.cqp.corpus.query.CQLQuery;
 import org.txm.utils.OSDetector;
 import org.txm.utils.Sh;
 import org.txm.utils.logger.Log;
@@ -415,4 +424,28 @@
 	public boolean isRunning() {
 		return state;
 	}
+
+	@Override
+	public Selection query(CorpusBuild corpus, Query query, String name, boolean saveQuery) throws CqiClientException {
+		if (query instanceof CQLQuery && corpus instanceof Corpus) {
+			return ((Corpus)corpus).query((CQLQuery)query, name, saveQuery);
+		} else {
+			return new EmptySelection(query); 
+		}
+	}
+
+	@Override
+	public Query newQuery() {
+		return new CQLQuery("");
+	}
+
+	@Override
+	public boolean hasIndexes(CorpusBuild corpus) {
+		try {
+			return CorpusManager.getCorpusManager().getCorpus(corpus.getName()) != null;
+		} catch (Exception e) {
+			e.printStackTrace();
+			return false;
+		}
+	}
 }
Index: tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/core/functions/preview/Preview.java
===================================================================
--- tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/core/functions/preview/Preview.java	(revision 1074)
+++ tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/core/functions/preview/Preview.java	(revision 1075)
@@ -39,7 +39,7 @@
 		boolean ok = false;
 		List<Match> matches = corpus.getMatches();
 		for (Match m : matches) {
-			if (m.getLength() >= n) {
+			if (m.size() >= n) {
 				ok = true;
 			}
 		}
@@ -52,7 +52,7 @@
 		
 		Match firstOkMatch = matches.get(0);
 		for (Match m : matches) {
-			if (m.getLength() >= n) {
+			if (m.size() >= n) {
 				Collection<? extends Integer> positions = m.getRange();
 				
 			}
