org.alfresco.repo.search.adaptor.lucene.AnalysisMode Java Examples
The following examples show how to use
org.alfresco.repo.search.adaptor.lucene.AnalysisMode.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: LuceneFTSRange.java From alfresco-data-model with GNU Lesser General Public License v3.0 | 6 votes |
public Q addComponent(Set<String> selectors, Map<String, Argument> functionArgs, LuceneQueryBuilderContext<Q, S, E> luceneContext, FunctionEvaluationContext functionContext) throws E { LuceneQueryParserAdaptor<Q, S, E> lqpa = luceneContext.getLuceneQueryParserAdaptor(); Argument argument = functionArgs.get(ARG_FROM_INC); Boolean fromInc = (Boolean) argument.getValue(functionContext); argument = functionArgs.get(ARG_FROM); String from = (String) argument.getValue(functionContext); argument = functionArgs.get(ARG_TO); String to = (String) argument.getValue(functionContext); argument = functionArgs.get(ARG_TO_INC); Boolean toInc = (Boolean) argument.getValue(functionContext); PropertyArgument propArg = (PropertyArgument) functionArgs.get(ARG_PROPERTY); Q query; if (propArg != null) { String prop = propArg.getPropertyName(); query = lqpa.getRangeQuery(functionContext.getLuceneFieldName(prop), from, to, fromInc, toInc, AnalysisMode.DEFAULT, LuceneFunction.FIELD); } else { query = lqpa.getRangeQuery(lqpa.getField(), from, to, fromInc, toInc, AnalysisMode.DEFAULT, LuceneFunction.FIELD); } return query; }
Example #2
Source File: LuceneFTSTerm.java From alfresco-data-model with GNU Lesser General Public License v3.0 | 6 votes |
public Q addComponent(Set<String> selectors, Map<String, Argument> functionArgs, LuceneQueryBuilderContext<Q, S, E> luceneContext, FunctionEvaluationContext functionContext) throws E { LuceneQueryParserAdaptor<Q, S, E> lqpa = luceneContext.getLuceneQueryParserAdaptor(); Argument argument = functionArgs.get(ARG_TERM); String term = (String) argument.getValue(functionContext); argument = functionArgs.get(ARG_TOKENISATION_MODE); AnalysisMode mode = (AnalysisMode) argument.getValue(functionContext); PropertyArgument propArg = (PropertyArgument) functionArgs.get(ARG_PROPERTY); Q query; if (propArg != null) { String prop = propArg.getPropertyName(); query = lqpa.getFieldQuery(functionContext.getLuceneFieldName(prop), term, mode, LuceneFunction.FIELD); } else { query = lqpa.getFieldQuery(lqpa.getField(), term, mode, LuceneFunction.FIELD); } return query; }
Example #3
Source File: LuceneFTSWildTerm.java From alfresco-data-model with GNU Lesser General Public License v3.0 | 6 votes |
public Q addComponent(Set<String> selectors, Map<String, Argument> functionArgs, LuceneQueryBuilderContext<Q, S, E> luceneContext, FunctionEvaluationContext functionContext) throws E { LuceneQueryParserAdaptor<Q, S, E> lqpa = luceneContext.getLuceneQueryParserAdaptor(); Argument argument = functionArgs.get(ARG_TERM); String term = (String) argument.getValue(functionContext); argument = functionArgs.get(ARG_TOKENISATION_MODE); AnalysisMode mode = (AnalysisMode) argument.getValue(functionContext); PropertyArgument propArg = (PropertyArgument) functionArgs.get(ARG_PROPERTY); Q query; if (propArg != null) { String prop = propArg.getPropertyName(); query = lqpa.getWildcardQuery(functionContext.getLuceneFieldName(prop), term, mode); } else { query = lqpa.getWildcardQuery(lqpa.getField(), term, mode); } return query; }
Example #4
Source File: LuceneFTSPrefixTerm.java From alfresco-data-model with GNU Lesser General Public License v3.0 | 6 votes |
public Q addComponent(Set<String> selectors, Map<String, Argument> functionArgs, LuceneQueryBuilderContext<Q, S, E> luceneContext, FunctionEvaluationContext functionContext) throws E { LuceneQueryParserAdaptor<Q, S, E> lqpa = luceneContext.getLuceneQueryParserAdaptor(); Argument argument = functionArgs.get(ARG_TERM); String term = (String) argument.getValue(functionContext); // strip trailing wildcard * term = term.substring(0, term.length()-1); argument = functionArgs.get(ARG_TOKENISATION_MODE); AnalysisMode mode = (AnalysisMode) argument.getValue(functionContext); PropertyArgument propArg = (PropertyArgument) functionArgs.get(ARG_PROPERTY); Q query; if (propArg != null) { String prop = propArg.getPropertyName(); query = lqpa.getPrefixQuery(functionContext.getLuceneFieldName(prop), term, mode); } else { query = lqpa.getPrefixQuery(lqpa.getField(), term, mode); } return query; }
Example #5
Source File: ParentLuceneBuilder.java From alfresco-data-model with GNU Lesser General Public License v3.0 | 5 votes |
@Override public <Q, S, E extends Throwable> Q buildLuceneExists(LuceneQueryParserAdaptor<Q, S, E> lqpa, Boolean not) throws E { if (not) { return lqpa.getFieldQuery("ISROOT", "T", AnalysisMode.IDENTIFIER, LuceneFunction.FIELD); } else { return lqpa.getNegatedQuery(lqpa.getFieldQuery("ISROOT", "T", AnalysisMode.IDENTIFIER, LuceneFunction.FIELD)); } }
Example #6
Source File: Lucene4QueryParserAdaptor.java From SearchServices with GNU Lesser General Public License v3.0 | 5 votes |
@Override public Query getIdentifierQuery(String field, String stringValue, AnalysisMode analysisMode, LuceneFunction luceneFunction) throws ParseException { String[] split = stringValue.split(";"); if(split.length == 1) { return lqp.getFieldQuery(field, stringValue, AnalysisMode.IDENTIFIER, luceneFunction); } else { if(split[1].equalsIgnoreCase("PWC")) { return getMatchNoneQuery(); } BooleanQuery.Builder query = new BooleanQuery.Builder(); BooleanQuery.Builder part1 = new BooleanQuery.Builder(); part1.add(lqp.getFieldQuery(field, split[0], AnalysisMode.IDENTIFIER, luceneFunction), Occur.MUST); part1.add(lqp.getFieldQuery("@"+ContentModel.PROP_VERSION_LABEL.toString(), split[1], AnalysisMode.IDENTIFIER, luceneFunction), Occur.MUST); query.add(part1.build(), Occur.SHOULD); if(split[1].equals("1.0")) { BooleanQuery.Builder part2 = new BooleanQuery.Builder(); part2.add(lqp.getFieldQuery(field, split[0], AnalysisMode.IDENTIFIER, luceneFunction), Occur.MUST); part2.add(lqp.getFieldQuery(QueryConstants.FIELD_ASPECT, ContentModel.ASPECT_VERSIONABLE.toString(), AnalysisMode.IDENTIFIER, luceneFunction), Occur.MUST_NOT); query.add(part2.build(), Occur.SHOULD); } return query.build(); } }
Example #7
Source File: CMISFTSQueryParser.java From alfresco-data-model with GNU Lesser General Public License v3.0 | 5 votes |
static private Constraint buildTerm(CommonTree testNode, QueryModelFactory factory, FunctionEvaluationContext functionEvaluationContext, Selector selector, Map<String, Column> columnMap) { String functionName = FTSTerm.NAME; Function function = factory.getFunction(functionName); Map<String, Argument> functionArguments = new LinkedHashMap<String, Argument>(); LiteralArgument larg = factory.createLiteralArgument(FTSTerm.ARG_TERM, DataTypeDefinition.TEXT, getText(testNode.getChild(0))); functionArguments.put(larg.getName(), larg); larg = factory.createLiteralArgument(FTSTerm.ARG_TOKENISATION_MODE, DataTypeDefinition.ANY, AnalysisMode.DEFAULT); functionArguments.put(larg.getName(), larg); return factory.createFunctionalConstraint(function, functionArguments); }
Example #8
Source File: CMISFTSQueryParser.java From alfresco-data-model with GNU Lesser General Public License v3.0 | 5 votes |
static private Constraint buildPhrase(CommonTree testNode, QueryModelFactory factory, FunctionEvaluationContext functionEvaluationContext, Selector selector, Map<String, Column> columnMap) { String functionName = FTSPhrase.NAME; Function function = factory.getFunction(functionName); Map<String, Argument> functionArguments = new LinkedHashMap<String, Argument>(); LiteralArgument larg = factory.createLiteralArgument(FTSPhrase.ARG_PHRASE, DataTypeDefinition.TEXT, getText(testNode.getChild(0))); functionArguments.put(larg.getName(), larg); larg = factory.createLiteralArgument(FTSPhrase.ARG_TOKENISATION_MODE, DataTypeDefinition.ANY, AnalysisMode.DEFAULT); functionArguments.put(larg.getName(), larg); return factory.createFunctionalConstraint(function, functionArguments); }
Example #9
Source File: ObjectTypeIdLuceneBuilder.java From alfresco-data-model with GNU Lesser General Public License v3.0 | 5 votes |
@Override public <Q, S, E extends Throwable> Q buildLuceneLike(LuceneQueryParserAdaptor<Q, S, E> lqpa, Serializable value, Boolean not) throws E { String field = getLuceneFieldName(); String stringValue = getValueAsString(value); TypeDefinitionWrapper type = cmisDictionaryService.findType(stringValue); String typeQName = type.getAlfrescoClass().toString(); Q q = lqpa.getLikeQuery(field, typeQName, AnalysisMode.IDENTIFIER); if (not) { q = lqpa.getNegatedQuery(q); } return q; }
Example #10
Source File: ObjectTypeIdLuceneBuilder.java From alfresco-data-model with GNU Lesser General Public License v3.0 | 5 votes |
@Override public <Q, S, E extends Throwable> Q buildLuceneEquality(LuceneQueryParserAdaptor<Q, S, E> lqpa, Serializable value, PredicateMode mode, LuceneFunction luceneFunction) throws E { String field = getLuceneFieldName(); String stringValue = getValueAsString(value); TypeDefinitionWrapper type = cmisDictionaryService.findType(stringValue); return lqpa .getFieldQuery(field, type.getAlfrescoClass().toString(), AnalysisMode.IDENTIFIER, luceneFunction); }
Example #11
Source File: ObjectIdLuceneBuilder.java From alfresco-data-model with GNU Lesser General Public License v3.0 | 5 votes |
@Override public <Q, S, E extends Throwable> Q buildLuceneLike(LuceneQueryParserAdaptor<Q, S, E> lqpa, Serializable value, Boolean not) throws E { String field = getLuceneFieldName(); String stringValue = getValueAsString(lqpa, value); Q q = lqpa.getIdentifieLikeQuery(field, stringValue, AnalysisMode.IDENTIFIER); if(not) { q = lqpa.getNegatedQuery(q); } return q; }
Example #12
Source File: ObjectIdLuceneBuilder.java From alfresco-data-model with GNU Lesser General Public License v3.0 | 5 votes |
@Override public <Q, S, E extends Throwable> Q buildLuceneEquality(LuceneQueryParserAdaptor<Q, S, E> lqpa, Serializable value, PredicateMode mode, LuceneFunction luceneFunction) throws E { String field = getLuceneFieldName(); String stringValue = getValueAsString(lqpa, value); return lqpa.getIdentifierQuery(field, stringValue, AnalysisMode.IDENTIFIER, luceneFunction); }
Example #13
Source File: ParentLuceneBuilder.java From alfresco-data-model with GNU Lesser General Public License v3.0 | 5 votes |
@Override public <Q, S, E extends Throwable> Q buildLuceneLike(LuceneQueryParserAdaptor<Q, S, E> lqpa, Serializable value, Boolean not) throws E { String field = getLuceneFieldName(); String stringValue = getValueAsString(lqpa, value); Q q = lqpa.getLikeQuery(field, stringValue, AnalysisMode.IDENTIFIER); if (not) { return lqpa.getNegatedQuery(q); } return q; }
Example #14
Source File: DBFTSPrefixTerm.java From alfresco-repository with GNU Lesser General Public License v3.0 | 5 votes |
@Override public void prepare(NamespaceService namespaceService, DictionaryService dictionaryService, QNameDAO qnameDAO, NodeDAO nodeDAO, TenantService tenantService, Set<String> selectors, Map<String, Argument> functionArgs, FunctionEvaluationContext functionContext, boolean supportBooleanFloatAndDouble) { Argument argument = functionArgs.get(ARG_TERM); String term = (String) argument.getValue(functionContext); // strip trailing wildcard * term = term.substring(0, term.length() - 1); PropertyArgument propertyArgument = (PropertyArgument) functionArgs.get(ARG_PROPERTY); argument = functionArgs.get(ARG_TOKENISATION_MODE); AnalysisMode mode = (AnalysisMode) argument.getValue(functionContext); if (mode != AnalysisMode.IDENTIFIER) { throw new QueryModelException("Analysis mode not supported for DB " + mode); } PropertySupport propertySupport = new PropertySupport(); propertySupport.setValue(term + "%"); QName propertyQName = QName.createQName(DBQuery.expandQName(functionContext.getAlfrescoPropertyName(propertyArgument.getPropertyName()), namespaceService)); propertySupport.setPropertyQName(propertyQName); propertySupport.setPropertyDataType(DBQuery.getDataTypeDefinition(dictionaryService, propertyQName)); propertySupport.setPair(qnameDAO.getQName(propertyQName)); propertySupport.setJoinCommandType(DBQuery.getJoinCommandType(propertyQName)); propertySupport.setFieldName(DBQuery.getFieldName(dictionaryService, propertyQName, supportBooleanFloatAndDouble)); propertySupport.setCommandType(DBQueryBuilderPredicatePartCommandType.LIKE); builderSupport = propertySupport; }
Example #15
Source File: AbstractSimpleLuceneBuilder.java From alfresco-data-model with GNU Lesser General Public License v3.0 | 5 votes |
@Override public <Q, S, E extends Throwable> Q buildLuceneLike(LuceneQueryParserAdaptor<Q, S, E> lqpa, Serializable value, Boolean not) throws E { String field = getLuceneFieldName(); String stringValue = getValueAsString(value); Q q = lqpa.getLikeQuery(field, stringValue, AnalysisMode.IDENTIFIER); if (not) { q = lqpa.getNegatedQuery(q); } return q; }
Example #16
Source File: AbstractSimpleLuceneBuilder.java From alfresco-data-model with GNU Lesser General Public License v3.0 | 5 votes |
@Override public <Q, S, E extends Throwable> Q buildLuceneLessThanOrEquals(LuceneQueryParserAdaptor<Q, S, E> lqpa, Serializable value, PredicateMode mode, LuceneFunction luceneFunction) throws E { String field = getLuceneFieldName(); String stringValue = getValueAsString(value); return lqpa.getRangeQuery(field, getRangeMin(), stringValue, true, true, AnalysisMode.IDENTIFIER, luceneFunction); }
Example #17
Source File: AbstractSimpleLuceneBuilder.java From alfresco-data-model with GNU Lesser General Public License v3.0 | 5 votes |
@Override public <Q, S, E extends Throwable> Q buildLuceneLessThan(LuceneQueryParserAdaptor<Q, S, E> lqpa, Serializable value, PredicateMode mode, LuceneFunction luceneFunction) throws E { String field = getLuceneFieldName(); String stringValue = getValueAsString(value); return lqpa.getRangeQuery(field, getRangeMin(), stringValue, true, false, AnalysisMode.IDENTIFIER, luceneFunction); }
Example #18
Source File: AbstractSimpleLuceneBuilder.java From alfresco-data-model with GNU Lesser General Public License v3.0 | 5 votes |
@Override public <Q, S, E extends Throwable> Q buildLuceneGreaterThanOrEquals(LuceneQueryParserAdaptor<Q, S, E> lqpa, Serializable value, PredicateMode mode, LuceneFunction luceneFunction) throws E { String field = getLuceneFieldName(); String stringValue = getValueAsString(value); return lqpa.getRangeQuery(field, stringValue, getRangeMax(), true, true, AnalysisMode.IDENTIFIER, luceneFunction); }
Example #19
Source File: AbstractSimpleLuceneBuilder.java From alfresco-data-model with GNU Lesser General Public License v3.0 | 5 votes |
@Override public <Q, S, E extends Throwable> Q buildLuceneGreaterThan(LuceneQueryParserAdaptor<Q, S, E> lqpa, Serializable value, PredicateMode mode, LuceneFunction luceneFunction) throws E { String field = getLuceneFieldName(); String stringValue = getValueAsString(value); return lqpa.getRangeQuery(field, stringValue, getRangeMax(), false, true, AnalysisMode.IDENTIFIER, luceneFunction); }
Example #20
Source File: AbstractSimpleLuceneBuilder.java From alfresco-data-model with GNU Lesser General Public License v3.0 | 5 votes |
@Override public <Q, S, E extends Throwable> Q buildLuceneExists(LuceneQueryParserAdaptor<Q, S, E> lqpa, Boolean not) throws E { if (not) { return lqpa.getFieldQuery("ISNULL", getQNameForExists().toString(), AnalysisMode.DEFAULT, LuceneFunction.FIELD); } else { return lqpa.getFieldQuery("ISNOTNULL", getQNameForExists().toString(), AnalysisMode.DEFAULT, LuceneFunction.FIELD); } }
Example #21
Source File: ParentLuceneBuilder.java From alfresco-data-model with GNU Lesser General Public License v3.0 | 5 votes |
@Override public <Q, S, E extends Throwable> Q buildLuceneEquality(LuceneQueryParserAdaptor<Q, S, E> lqpa, Serializable value, PredicateMode mode, LuceneFunction luceneFunction) throws E { String field = getLuceneFieldName(); String stringValue = getValueAsString(lqpa, value); return lqpa.getFieldQuery(field, stringValue, AnalysisMode.IDENTIFIER, luceneFunction); }
Example #22
Source File: LuceneFTSPhrase.java From alfresco-data-model with GNU Lesser General Public License v3.0 | 5 votes |
public Q addComponent(Set<String> selectors, Map<String, Argument> functionArgs, LuceneQueryBuilderContext<Q, S, E> luceneContext, FunctionEvaluationContext functionContext) throws E { LuceneQueryParserAdaptor<Q, S, E> lqpa = luceneContext.getLuceneQueryParserAdaptor(); Argument argument = functionArgs.get(ARG_PHRASE); String term = (String) argument.getValue(functionContext); Integer slop = Integer.valueOf(lqpa.getPhraseSlop()); argument = functionArgs.get(ARG_SLOP); if(argument != null) { slop = (Integer) argument.getValue(functionContext); } argument = functionArgs.get(ARG_TOKENISATION_MODE); AnalysisMode mode = (AnalysisMode) argument.getValue(functionContext); PropertyArgument propArg = (PropertyArgument) functionArgs.get(ARG_PROPERTY); Q query; if (propArg != null) { String prop = propArg.getPropertyName(); query = lqpa.getFieldQuery(functionContext.getLuceneFieldName(prop), term, mode, slop, LuceneFunction.FIELD); } else { query = lqpa.getFieldQuery(lqpa.getField(), term, mode, slop, LuceneFunction.FIELD); } return query; }
Example #23
Source File: AbstractSimpleLuceneBuilder.java From alfresco-data-model with GNU Lesser General Public License v3.0 | 4 votes |
@Override public <Q, S, E extends Throwable> Q buildLuceneEquality(LuceneQueryParserAdaptor<Q, S, E> lqpa, Serializable value, PredicateMode mode, LuceneFunction luceneFunction) throws E { return lqpa.getFieldQuery(getLuceneFieldName(), getValueAsString(value), AnalysisMode.IDENTIFIER, luceneFunction); }
Example #24
Source File: Lucene4QueryParserAdaptor.java From SearchServices with GNU Lesser General Public License v3.0 | 4 votes |
@Override public Query getWildcardQuery(String luceneFieldName, String term, AnalysisMode analysisMode) throws ParseException { return lqp.getWildcardQuery(luceneFieldName, term, analysisMode); }
Example #25
Source File: Lucene4QueryParserAdaptor.java From SearchServices with GNU Lesser General Public License v3.0 | 4 votes |
@Override public Query getPrefixQuery(String luceneFieldName, String term, AnalysisMode analysisMode) throws ParseException { return lqp.getPrefixQuery(luceneFieldName, term, analysisMode); }
Example #26
Source File: Lucene4QueryParserAdaptor.java From SearchServices with GNU Lesser General Public License v3.0 | 4 votes |
@Override public Query getFieldQuery(String luceneFieldName, String term, AnalysisMode analysisMode, Integer slop, LuceneFunction luceneFunction) throws ParseException { return lqp.getFieldQuery(luceneFieldName, term, analysisMode, slop, luceneFunction); }
Example #27
Source File: Lucene4QueryParserAdaptor.java From SearchServices with GNU Lesser General Public License v3.0 | 4 votes |
@Override public Query getIdentifieLikeQuery(String field, String sqlLikeClause, AnalysisMode analysisMode) throws ParseException { return getLikeQuery(field, sqlLikeClause, analysisMode); }
Example #28
Source File: Lucene4QueryParserAdaptor.java From SearchServices with GNU Lesser General Public License v3.0 | 4 votes |
@Override public Query getLikeQuery(String field, String sqlLikeClause, AnalysisMode analysisMode) throws ParseException { return lqp.getLikeQuery(field, sqlLikeClause, analysisMode); }
Example #29
Source File: Lucene4QueryParserAdaptor.java From SearchServices with GNU Lesser General Public License v3.0 | 4 votes |
@Override public Query getRangeQuery(String field, String lower, String upper, boolean includeLower, boolean includeUpper, AnalysisMode analysisMode, LuceneFunction luceneFunction) throws ParseException { return lqp.getRangeQuery(field, lower, upper, includeLower, includeUpper, analysisMode, luceneFunction); }
Example #30
Source File: Lucene4QueryParserAdaptor.java From SearchServices with GNU Lesser General Public License v3.0 | 4 votes |
@Override public Query getFieldQuery(String field, String queryText, AnalysisMode analysisMode, LuceneFunction luceneFunction) throws ParseException { return lqp.getFieldQuery(field, queryText, analysisMode, luceneFunction); }