protected FullTextSearch fullTextSearch( SelectorName name, String propertyName, StaticOperand expression ) throws RepositoryException { return new FullTextSearch(name, propertyName, expression, null); }
@Override public void visit( FullTextSearch fullText ) { append("CONTAINS(").append(fullText.selectorName()); if (fullText.getPropertyName() != null) { append('.').appendPropertyName(fullText.getPropertyName()); } sb.append(",'").append(fullText.fullTextSearchExpression()).append("')"); }
@Override public void visit( FullTextSearch fullText ) { append("CONTAINS(").append(fullText.selectorName()); if (fullText.getPropertyName() != null) { append('.').appendPropertyName(fullText.getPropertyName()); } sb.append(','); fullText.getFullTextSearchExpression().accept(this); sb.append(')'); }
protected boolean applies( FullTextSearch constraint ) { if (defn.getKind() != IndexDefinition.IndexKind.TEXT) { return false; } if (!matchesSelectorName(constraint.getSelectorName())) { return false; } String propertyName = constraint.getPropertyName(); if (propertyName != null && !defn.appliesToProperty(propertyName)) { return false; } return true; }
if (".".equals(search.getPropertyName())) { return new FullTextSearch(search.selectorName(), search.fullTextSearchExpression());
final StaticOperand ftsExpression = ((FullTextSearch)constraint).getFullTextSearchExpression(); final FullTextSearch fts; if (ftsExpression instanceof BindVariableName) { Object searchExpression = literalValue(ftsExpression, context, strings); if (searchExpression != null) { fts = ((FullTextSearch)constraint).withFullTextExpression(searchExpression.toString()); } else { fts = (FullTextSearch)constraint; String selectorName = fts.getSelectorName(); String propertyName = fts.getPropertyName(); final int index = columns.getSelectorIndex(selectorName); ExtractFromRow fullTextExtractor = null;
@Override public void visit( FullTextSearch obj ) { SelectorName selectorName = obj.selectorName(); if (obj.getPropertyName() != null) { Schemata.Column column = verify(selectorName, obj.getPropertyName(), this.validateColumnExistence); if (column != null) { // Make sure the column is full-text searchable ... if (!column.isFullTextSearchable()) { problems.addError(GraphI18n.columnIsNotFullTextSearchable, column.getName(), selectorName); } } } else { Table table = verify(selectorName); // Don't need to check if the selector is the '__ALLNODES__' selector ... if (table != null && !AllNodes.ALL_NODES_NAME.equals(table.getName())) { // Make sure there is at least one column on the table that is full-text searchable ... boolean searchable = false; for (Schemata.Column column : table.getColumns()) { if (column.isFullTextSearchable()) { searchable = true; break; } } if (!searchable) { problems.addError(GraphI18n.tableIsNotFullTextSearchable, selectorName); } } } }
@Override public String getString() { return fullTextSearchExpression(); }
@Override public void visit( FullTextSearch fullTextSearch ) { symbols.add(fullTextSearch.selectorName()); }
@Override protected boolean evaluate( Object leftHandValue ) { /** * The term will match the extracted value "as-is" via regex, without any stemming or punctuation removal. * This means that the matching is done in a much more strict way than what Lucene did in 3.x If we were to * implement stemming or hyphen removal, we would need to do it *both* in the row extractor * (RowExtractors.extractFullText) and in the term where the regex is built */ return fts.getTerm().matches(leftHandValue.toString()); } };
@Override public void visit( FullTextSearch fullTextSearch ) { strategy.visit(fullTextSearch); enqueue(fullTextSearch.getFullTextSearchExpression()); visitNext(); }
/** * Create a constraint defining a full-text search against the property values on node within the search scope. * * @param selectorName the name of the node selector defining the search scope * @param propertyName the name of the property to be searched; may be null if all property values are to be searched * @param fullTextSearchExpression the search expression * @param term the term representation, if it is known; may be null * @throws RepositoryException if there is an error converting the full text search expression to a string */ public FullTextSearch( SelectorName selectorName, String propertyName, StaticOperand fullTextSearchExpression, Term term ) throws RepositoryException { CheckArg.isNotNull(selectorName, "selectorName"); CheckArg.isNotNull(fullTextSearchExpression, "fullTextSearchExpression"); String expressionString = toString(fullTextSearchExpression); CheckArg.isNotEmpty(expressionString, "fullTextSearchExpression"); this.selectorName = selectorName; this.propertyName = propertyName; this.term = term; this.fullTextSearchExpression = expressionString; this.hc = HashCode.compute(this.selectorName, this.propertyName, this.fullTextSearchExpression); this.expression = fullTextSearchExpression; }
if (".".equals(search.getPropertyName())) { return new FullTextSearch(search.selectorName(), search.fullTextSearchExpression());
final StaticOperand ftsExpression = ((FullTextSearch)constraint).getFullTextSearchExpression(); final FullTextSearch fts; if (ftsExpression instanceof BindVariableName) { Object searchExpression = literalValue(ftsExpression, context, strings); if (searchExpression != null) { fts = ((FullTextSearch)constraint).withFullTextExpression(searchExpression.toString()); } else { fts = (FullTextSearch)constraint; String selectorName = fts.getSelectorName(); String propertyName = fts.getPropertyName(); final int index = columns.getSelectorIndex(selectorName); ExtractFromRow fullTextExtractor = null;
@Override public void visit( FullTextSearch obj ) { SelectorName selectorName = obj.selectorName(); if (obj.getPropertyName() != null) { Schemata.Column column = verify(selectorName, obj.getPropertyName(), this.validateColumnExistence); if (column != null) { // Make sure the column is full-text searchable ... if (!column.isFullTextSearchable()) { problems.addError(GraphI18n.columnIsNotFullTextSearchable, column.getName(), selectorName); } } } else { Table table = verify(selectorName); // Don't need to check if the selector is the '__ALLNODES__' selector ... if (table != null && !AllNodes.ALL_NODES_NAME.equals(table.getName())) { // Make sure there is at least one column on the table that is full-text searchable ... boolean searchable = false; for (Schemata.Column column : table.getColumns()) { if (column.isFullTextSearchable()) { searchable = true; break; } } if (!searchable) { problems.addError(GraphI18n.tableIsNotFullTextSearchable, selectorName); } } } }
@Override public String getString() { return fullTextSearchExpression(); }
protected boolean applies( FullTextSearch constraint ) { if (defn.getKind() != IndexDefinition.IndexKind.TEXT) { return false; } if (!matchesSelectorName(constraint.getSelectorName())) { return false; } String propertyName = constraint.getPropertyName(); if (propertyName != null && !defn.appliesToProperty(propertyName)) { return false; } return true; }
@Override public void visit( FullTextSearch fullTextSearch ) { symbols.add(fullTextSearch.selectorName()); }
@Override protected boolean evaluate( Object leftHandValue ) { /** * The term will match the extracted value "as-is" via regex, without any stemming or punctuation removal. * This means that the matching is done in a much more strict way than what Lucene did in 3.x If we were to * implement stemming or hyphen removal, we would need to do it *both* in the row extractor * (RowExtractors.extractFullText) and in the term where the regex is built */ return fts.getTerm().matches(leftHandValue.toString()); } };
@Override public void visit( FullTextSearch fullTextSearch ) { strategy.visit(fullTextSearch); enqueue(fullTextSearch.getFullTextSearchExpression()); visitNext(); }