mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
Merged V2.1 to HEAD
6386: Fix for AR-1649 6387: Fix for AR-1645 6388: Updated Polish messages 6389: Updated security providers 6392: Add support to log in as guest with any password (if guest is allowed) 6393: AR-1562 : Cannot directly exit/disable Alfresco JavaScript Debugger window 6394: Allow creation of PropertyValue persisted properties without knowing the type QName 6397: Log Serializable properties don't cause infinte waits 6398: Build fix and tidy up for authentication chaining Resolved conflicted state of 'root\projects\repository\source\java\org\alfresco\repo\security\authentication\AuthenticationUtil.java' 6402: AR-1643 Web Script args object does not handle multi-value arguments 6407: Removed use of QName "{}silly" as a data type definition. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@6728 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -393,7 +393,7 @@ public class ADMLuceneTest extends TestCase
|
||||
writer.putContent("The quick brown fox jumped over the lazy dog and ate the Alfresco Tutorial, in pdf format, along with the following stop words; a an and are"
|
||||
+ " as at be but by for if in into is it no not of on or such that the their then there these they this to was will with: "
|
||||
+ " and random charcters \u00E0\u00EA\u00EE\u00F0\u00F1\u00F6\u00FB\u00FF");
|
||||
System.out.println("Size is " + writer.getSize());
|
||||
//System.out.println("Size is " + writer.getSize());
|
||||
|
||||
nodeService.addChild(rootNodeRef, n8, ContentModel.ASSOC_CHILDREN, QName.createQName("{namespace}eight-0"));
|
||||
nodeService.addChild(n1, n8, ASSOC_TYPE_QNAME, QName.createQName("{namespace}eight-1"));
|
||||
@@ -2527,6 +2527,49 @@ public class ADMLuceneTest extends TestCase
|
||||
assertNotNull(results.getRow(0).getValue(QName.createQName(TEST_NAMESPACE, "any-many-ista")));
|
||||
results.close();
|
||||
|
||||
// proximity searches
|
||||
|
||||
results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "TEXT:\"Tutorial Alfresco\"~0", null, null);
|
||||
assertEquals(0, results.length());
|
||||
results.close();
|
||||
|
||||
results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "TEXT:\"Tutorial Alfresco\"~1", null, null);
|
||||
assertEquals(0, results.length());
|
||||
results.close();
|
||||
|
||||
results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "TEXT:\"Tutorial Alfresco\"~2", null, null);
|
||||
assertEquals(1, results.length());
|
||||
results.close();
|
||||
|
||||
results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "TEXT:\"Tutorial Alfresco\"~3", null, null);
|
||||
assertEquals(1, results.length());
|
||||
results.close();
|
||||
|
||||
|
||||
results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "@" + LuceneQueryParser.escape(ContentModel.PROP_DESCRIPTION.toString())+":\"Alfresco Tutorial\"", null, null);
|
||||
assertEquals(1, results.length());
|
||||
results.close();
|
||||
|
||||
results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "@" + LuceneQueryParser.escape(ContentModel.PROP_DESCRIPTION.toString())+":\"Tutorial Alfresco\"", null, null);
|
||||
assertEquals(0, results.length());
|
||||
results.close();
|
||||
|
||||
results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "@" + LuceneQueryParser.escape(ContentModel.PROP_DESCRIPTION.toString())+":\"Tutorial Alfresco\"~0", null, null);
|
||||
assertEquals(0, results.length());
|
||||
results.close();
|
||||
|
||||
results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "@" + LuceneQueryParser.escape(ContentModel.PROP_DESCRIPTION.toString())+":\"Tutorial Alfresco\"~1", null, null);
|
||||
assertEquals(0, results.length());
|
||||
results.close();
|
||||
|
||||
results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "@" + LuceneQueryParser.escape(ContentModel.PROP_DESCRIPTION.toString())+":\"Tutorial Alfresco\"~2", null, null);
|
||||
assertEquals(1, results.length());
|
||||
results.close();
|
||||
|
||||
results = searcher.query(rootNodeRef.getStoreRef(), "lucene", "@" + LuceneQueryParser.escape(ContentModel.PROP_DESCRIPTION.toString())+":\"Tutorial Alfresco\"~3", null, null);
|
||||
assertEquals(1, results.length());
|
||||
results.close();
|
||||
|
||||
// multi ml text
|
||||
|
||||
QName multimlQName = QName.createQName(TEST_NAMESPACE, "mltext-many-ista");
|
||||
|
@@ -262,7 +262,7 @@ public class LuceneAnalyser extends Analyzer
|
||||
PropertyDefinition propertyDef = dictionaryService.getProperty(propertyQName);
|
||||
if (propertyDef != null)
|
||||
{
|
||||
if (propertyDef.getDataType().equals(DataTypeDefinition.MLTEXT))
|
||||
if (propertyDef.getDataType().getName().equals(DataTypeDefinition.MLTEXT))
|
||||
{
|
||||
return 1000;
|
||||
}
|
||||
|
@@ -90,6 +90,8 @@ public class LuceneQueryParser extends QueryParser
|
||||
|
||||
private IndexReader indexReader;
|
||||
|
||||
private int internalSlop = 0;
|
||||
|
||||
/**
|
||||
* Parses a query string, returning a {@link org.apache.lucene.search.Query}.
|
||||
*
|
||||
@@ -168,6 +170,21 @@ public class LuceneQueryParser extends QueryParser
|
||||
super(arg0);
|
||||
}
|
||||
|
||||
protected Query getFieldQuery(String field, String queryText, int slop) throws ParseException
|
||||
{
|
||||
try
|
||||
{
|
||||
internalSlop = slop;
|
||||
Query query = getFieldQuery(field, queryText);
|
||||
return query;
|
||||
}
|
||||
finally
|
||||
{
|
||||
internalSlop = 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected Query getFieldQuery(String field, String queryText) throws ParseException
|
||||
{
|
||||
try
|
||||
@@ -691,7 +708,7 @@ public class LuceneQueryParser extends QueryParser
|
||||
{
|
||||
v.add(it.next());
|
||||
count++;
|
||||
if(count > 1)
|
||||
if (count > 1)
|
||||
{
|
||||
severalTokensAtSamePosition = true;
|
||||
}
|
||||
@@ -752,7 +769,7 @@ public class LuceneQueryParser extends QueryParser
|
||||
{
|
||||
v.add(it.next());
|
||||
count++;
|
||||
if(count > 1)
|
||||
if (count > 1)
|
||||
{
|
||||
severalTokensAtSamePosition = true;
|
||||
}
|
||||
@@ -1019,7 +1036,7 @@ public class LuceneQueryParser extends QueryParser
|
||||
{
|
||||
// phrase query:
|
||||
MultiPhraseQuery mpq = new MultiPhraseQuery();
|
||||
mpq.setSlop(phraseSlop);
|
||||
mpq.setSlop(internalSlop);
|
||||
ArrayList<Term> multiTerms = new ArrayList<Term>();
|
||||
for (int i = 0; i < v.size(); i++)
|
||||
{
|
||||
@@ -1053,7 +1070,7 @@ public class LuceneQueryParser extends QueryParser
|
||||
else
|
||||
{
|
||||
MultiPhraseQuery q = new MultiPhraseQuery();
|
||||
q.setSlop(phraseSlop);
|
||||
q.setSlop(internalSlop);
|
||||
for (int i = 0; i < v.size(); i++)
|
||||
{
|
||||
t = (org.apache.lucene.analysis.Token) v.get(i);
|
||||
@@ -1096,9 +1113,9 @@ public class LuceneQueryParser extends QueryParser
|
||||
while (!wcte.endEnum())
|
||||
{
|
||||
Term current = wcte.term();
|
||||
if((current.text() != null) && (current.text().length() > 0) && (current.text().charAt(0) == '{'))
|
||||
if ((current.text() != null) && (current.text().length() > 0) && (current.text().charAt(0) == '{'))
|
||||
{
|
||||
if((term != null) && (term.text().length() > 0) && (term.text().charAt(0) == '{'))
|
||||
if ((term != null) && (term.text().length() > 0) && (term.text().charAt(0) == '{'))
|
||||
{
|
||||
terms.add(current);
|
||||
}
|
||||
@@ -1108,7 +1125,7 @@ public class LuceneQueryParser extends QueryParser
|
||||
{
|
||||
terms.add(current);
|
||||
}
|
||||
|
||||
|
||||
wcte.next();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user