Examples of FullTextSearch

  • org.apache.jackrabbit.spi.commons.query.jsr283.qom.FullTextSearch
    Performs a full-text search.

    The full-text search expression is evaluated against the set of full-text indexed properties within the full-text search scope. If {@link #getPropertyName property} is specified, the full-text search scopeis the property of that name on the {@link #getSelectorName selector} nodein the node-tuple; otherwise the full-text search scope is all properties of the {@link #getSelectorName selector} node (or, in some implementations,all properties in the node subtree).

    Which properties (if any) in a repository are full-text indexed is implementation determined.

    It is also implementation determined whether {@link #getFullTextSearchExpression fullTextSearchExpression} isindependently evaluated against each full-text indexed property in the full-text search scope, or collectively evaluated against the set of such properties using some implementation-determined mechanism.

    Similarly, for multi-valued properties, it is implementation determined whether {@link #getFullTextSearchExpression fullTextSearchExpression} isindependently evaluated against each element in the array of values, or collectively evaluated against the array of values using some implementation-determined mechanism.

    At minimum, an implementation must support the following {@link #getFullTextSearchExpression fullTextSearchExpression} grammar:

      fullTextSearchExpression ::= [-]term {whitespace [OR] whitespace [-]term} 

    term ::= word | '"' word {whitespace word} '"'

    word ::= (A string containing no whitespace)

    whitespace ::= (A string of only whitespace)

    A query satisfies a FullTextSearch constraint if the value (or values) of the full-text indexed properties within the full-text search scope satisfy the specified {@link #getFullTextSearchExpression fullTextSearchExpression}, evaluated as follows:

    The query is invalid if:

    If {@link #getPropertyName property} is specified but, for a node-tuple,the selector node does not have a property named {@link #getPropertyName property}, the query is valid but the constraint is not satisfied.

  • @since JCR 2.0
  • org.jboss.dna.graph.query.model.FullTextSearch
    A constraint that evaluates to true only when a full-text search applied to the search scope results in positive findings. If a property name is supplied, then the search is limited to the value(s) of the named property on the node(s) in the search scope.
  • org.modeshape.jcr.query.model.FullTextSearch
    A constraint that evaluates to true only when a full-text search applied to the search scope results in positive findings. If a property name is supplied, then the search is limited to the value(s) of the named property on the node(s) in the search scope.

  • Examples of org.modeshape.jcr.query.model.FullTextSearch

        @Test
        public void shouldParseConstraintFromStringWithIsContainsExpressionWithPropertyAndNoSelectorNameOnlyIfThereIsOneSelectorSource() {
            NamedSelector selector = new NamedSelector(selectorName("tableA"));
            Constraint constraint = parser.parseConstraint(tokens("CONTAINS(propertyA,'term1 term2 -term3')"), typeSystem, selector);
            assertThat(constraint, is(instanceOf(FullTextSearch.class)));
            FullTextSearch search = (FullTextSearch)constraint;
            assertThat(search.selectorName(), is(selectorName("tableA")));
            assertThat(search.getPropertyName(), is("propertyA"));
            assertThat(search.fullTextSearchExpression(), is("term1 term2 -term3"));
        }
    View Full Code Here

    Examples of org.modeshape.jcr.query.model.FullTextSearch

        public void shouldParseConstraintFromStringWithIsContainsExpressionWithSelectorNameAndProperty() {
            Constraint constraint = parser.parseConstraint(tokens("CONTAINS(tableA.propertyA,'term1 term2 -term3')"),
                                                           typeSystem,
                                                           mock(Source.class));
            assertThat(constraint, is(instanceOf(FullTextSearch.class)));
            FullTextSearch search = (FullTextSearch)constraint;
            assertThat(search.selectorName(), is(selectorName("tableA")));
            assertThat(search.getPropertyName(), is("propertyA"));
            assertThat(search.fullTextSearchExpression(), is("term1 term2 -term3"));
        }
    View Full Code Here

    Examples of org.modeshape.jcr.query.model.FullTextSearch

        public void shouldParseConstraintFromStringWithIsContainsExpressionWithSelectorNameAndAnyProperty() {
            Constraint constraint = parser.parseConstraint(tokens("CONTAINS(tableA.*,'term1 term2 -term3')"),
                                                           typeSystem,
                                                           mock(Source.class));
            assertThat(constraint, is(instanceOf(FullTextSearch.class)));
            FullTextSearch search = (FullTextSearch)constraint;
            assertThat(search.selectorName(), is(selectorName("tableA")));
            assertThat(search.getPropertyName(), is(nullValue()));
            assertThat(search.fullTextSearchExpression(), is("term1 term2 -term3"));
        }
    View Full Code Here

    Examples of org.modeshape.jcr.query.model.FullTextSearch

            // Create the expected plan ...
            PlanNode access = new PlanNode(Type.ACCESS, selector("type1"));
            PlanNode project = new PlanNode(Type.PROJECT, access, selector("type1"));
            project.setProperty(Property.PROJECT_COLUMNS, columns(column("type1", "a1", "a"), column("type1", "a2", "b")));
            PlanNode select1 = new PlanNode(Type.SELECT, project, selector("type1"));
            select1.setProperty(Property.SELECT_CRITERIA, new FullTextSearch(selector("type1"), "a2", "something"));
            PlanNode select2 = new PlanNode(Type.SELECT, select1, selector("type1"));
            select2.setProperty(Property.SELECT_CRITERIA, new SetCriteria(new PropertyValue(selector("type1"), "primaryType"),
                                                                          new Literal("t1"), new Literal("t0")));
            PlanNode select3 = new PlanNode(Type.SELECT, select2, selector("type1"));
            select3.setProperty(Property.SELECT_CRITERIA, new SetCriteria(new PropertyValue(selector("type1"), "mixins"),
    View Full Code Here

    Examples of org.modeshape.jcr.query.model.FullTextSearch

            PlanNode project = new PlanNode(Type.PROJECT, access, selector("type1"));
            project.setProperty(Property.PROJECT_COLUMNS,
                                columns(column("type1", "a1", "a"), column("type1", "a2", "b"), column("type1", "a3", "c"),
                                        column("type1", "a4", "d")));
            PlanNode select1 = new PlanNode(Type.SELECT, project, selector("type1"));
            select1.setProperty(Property.SELECT_CRITERIA, new FullTextSearch(selector("type1"), "a2", "something"));
            PlanNode select2 = new PlanNode(Type.SELECT, select1, selector("type1"));
            select2.setProperty(Property.SELECT_CRITERIA, new SetCriteria(new PropertyValue(selector("type1"), "primaryType"),
                                                                          new Literal("t1"), new Literal("t0")));
            PlanNode select3 = new PlanNode(Type.SELECT, select2, selector("type1"));
            select3.setProperty(Property.SELECT_CRITERIA, new SetCriteria(new PropertyValue(selector("type1"), "mixins"),
    View Full Code Here

    Examples of org.modeshape.jcr.query.model.FullTextSearch

            PlanNode leftAccess = new PlanNode(Type.ACCESS, join, selector("type1"));
            PlanNode leftProject = new PlanNode(Type.PROJECT, leftAccess, selector("type1"));
            leftProject.setProperty(Property.PROJECT_COLUMNS, columns(column("type1", "a1"), column("type1", "a2")));
            PlanNode leftSelect1 = new PlanNode(Type.SELECT, leftProject, selector("type1"));
            leftSelect1.setProperty(Property.SELECT_CRITERIA, new FullTextSearch(selector("type1"), "a1", "something"));
            PlanNode leftSelect2 = new PlanNode(Type.SELECT, leftSelect1, selector("type1"));
            leftSelect2.setProperty(Property.SELECT_CRITERIA, new SetCriteria(new PropertyValue(selector("type1"), "primaryType"),
                                                                              new Literal("t1"), new Literal("t0")));
            PlanNode leftSelect3 = new PlanNode(Type.SELECT, leftSelect2, selector("type1"));
            leftSelect3.setProperty(Property.SELECT_CRITERIA, new SetCriteria(new PropertyValue(selector("type1"), "mixins"),
    View Full Code Here

    Examples of org.modeshape.jcr.query.model.FullTextSearch

            PlanNode project = new PlanNode(Type.PROJECT, access, selector("type1"));
            project.setProperty(Property.PROJECT_COLUMNS,
                                columns(column("type1", "a1", "a"), column("type1", "a2", "b"), column("type1", "a3", "c"),
                                        column("type1", "a4", "d")));
            PlanNode select1 = new PlanNode(Type.SELECT, project, selector("type1"));
            select1.setProperty(Property.SELECT_CRITERIA, new FullTextSearch(selector("type1"), "a2", "something"));
            PlanNode select2 = new PlanNode(Type.SELECT, select1, selector("type1"));
            select2.setProperty(Property.SELECT_CRITERIA, new SetCriteria(new PropertyValue(selector("type1"), "primaryType"),
                                                                          new Literal("t1"), new Literal("t0")));
            PlanNode select3 = new PlanNode(Type.SELECT, select2, selector("type1"));
            select3.setProperty(Property.SELECT_CRITERIA, new SetCriteria(new PropertyValue(selector("type1"), "mixins"),
    View Full Code Here

    Examples of org.modeshape.jcr.query.model.FullTextSearch

        protected FullTextSearch fullTextSearch( SelectorName name,
                                                 String propertyName,
                                                 String expression,
                                                 Term term ) {
            return new FullTextSearch(name, propertyName, expression, term);
        }
    View Full Code Here

    Examples of org.modeshape.jcr.query.model.FullTextSearch

        }

        protected FullTextSearch fullTextSearch( SelectorName name,
                                                 String propertyName,
                                                 StaticOperand expression ) throws RepositoryException {
            return new FullTextSearch(name, propertyName, expression, null);
        }
    View Full Code Here

    Examples of org.modeshape.jcr.query.model.FullTextSearch

                };
            }
            if (constraint instanceof FullTextSearch) {
                final TypeFactory<String> strings = context.getTypeSystem().getStringFactory();
                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;
                    }
                } else {
                    fts = (FullTextSearch)constraint;
                }

                final NodeCache cache = context.getNodeCache(sources.getWorkspaceName());
                final BinaryStore binaries = context.getExecutionContext().getBinaryStore();
                String selectorName = fts.getSelectorName();
                String propertyName = fts.getPropertyName();
                final int index = columns.getSelectorIndex(selectorName);
                ExtractFromRow fullTextExtractor = null;
                if (propertyName != null) {
                    // This is to search just the designated property of the node (name, all property values) ...
                    final ExtractFromRow propertyValueExtractor = createExtractFromRow(selectorName, propertyName, context, columns,
                                                                                       sources, strings, true);
                    fullTextExtractor = new ExtractFromRow() {
                        @Override
                        public TypeFactory<?> getType() {
                            return strings;
                        }

                        @Override
                        public Object getValueInRow( RowAccessor row ) {
                            Object result = propertyValueExtractor.getValueInRow(row);
                            if (result == null) return null;
                            StringBuilder fullTextString = new StringBuilder();
                            RowExtractors.extractFullTextFrom(result, strings, binaries, fullTextString);
                            return fullTextString.toString();
                        }
                    };
                } else {
                    // This is to search all aspects of the node (name, all property values) ...
                    fullTextExtractor = RowExtractors.extractFullText(index, cache, context.getTypeSystem(), binaries);
                }
                // Return a filter that processes all of the text ...
                final ExtractFromRow extractor = fullTextExtractor;
                return new DynamicOperandFilter(extractor) {
                    @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());
                    }
                };
            }
            if (constraint instanceof Relike) {
                Relike relike = (Relike)constraint;
    View Full Code Here
    TOP
    Copyright © 2018 www.massapi.com. All rights reserved.
    All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.