Examples of FullTextSearchScore


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

                                                   String propertyName ) {
        return new PropertyExistence(selector, propertyName);
    }

    protected FullTextSearchScore fullTextSearchScore( SelectorName selector ) {
        return new FullTextSearchScore(selector);
    }
View Full Code Here

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

            }
            if ("mode:id".equals(property)) {
                return new NodeId(propValue.selectorName());
            }
            if ("jcr:score".equals(property)) {
                return new FullTextSearchScore(propValue.selectorName());
            }
        }
        return operand;
    }
View Full Code Here

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

                    return "(localName " + nodeName.getSelectorName() + ")";
                }
            };
        }
        if (operand instanceof FullTextSearchScore) {
            final FullTextSearchScore fts = (FullTextSearchScore)operand;
            final int indexInRow = columns.getSelectorIndex(fts.getSelectorName());
            final TypeFactory<Double> doubleType = context.getTypeSystem().getDoubleFactory();
            return new ExtractFromRow() {
                @Override
                public TypeFactory<?> getType() {
                    return doubleType;
                }

                @Override
                public Object getValueInRow( RowAccessor row ) {
                    return new Double(row.getScore(indexInRow)); // must convert the float to a double value
                }

                @Override
                public String toString() {
                    return "(fullTextScore " + fts.getSelectorName() + ")";
                }
            };
        }
        if (operand instanceof ArithmeticOperand) {
            // This works on single-valued properties only ...
View Full Code Here

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

                    NodePath path = new NodePath(propValue.selectorName());
                    return new Comparison(path, comparison.operator(), comparison.getOperand2());
                }
                if ("jcr:score".equals(propValue.getPropertyName())) {
                    // Rewrite this constraint as a SCORE criteria ...
                    FullTextSearchScore score = new FullTextSearchScore(propValue.selectorName());
                    return new Comparison(score, comparison.operator(), comparison.getOperand2());
                }
            }
        } else if (constraint instanceof FullTextSearch) {
            FullTextSearch search = (FullTextSearch)constraint;
View Full Code Here

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

    public static DynamicOperand replaceReferencesToRemovedSource( QueryContext context,
                                                                   DynamicOperand operand,
                                                                   Map<SelectorName, SelectorName> rewrittenSelectors ) {
        if (operand instanceof FullTextSearchScore) {
            FullTextSearchScore score = (FullTextSearchScore)operand;
            SelectorName replacement = rewrittenSelectors.get(score.selectorName());
            if (replacement == null) return score;
            return new FullTextSearchScore(replacement);
        }
        if (operand instanceof Length) {
            Length operation = (Length)operand;
            PropertyValue wrapped = operation.getPropertyValue();
            SelectorName replacement = rewrittenSelectors.get(wrapped.selectorName());
View Full Code Here

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

            DynamicOperand newLeft = replaceViewReferences(context, arith.getLeft(), mapping, node);
            DynamicOperand newRight = replaceViewReferences(context, arith.getRight(), mapping, node);
            return new ArithmeticOperand(newLeft, arith.operator(), newRight);
        }
        if (operand instanceof FullTextSearchScore) {
            FullTextSearchScore score = (FullTextSearchScore)operand;
            if (!mapping.getOriginalName().equals(score.selectorName())) return score;
            if (mapping.isMappedToSingleSelector()) {
                return new FullTextSearchScore(mapping.getSingleMappedSelectorName());
            }
            // There are multiple mappings, so we have to create a composite score ...
            DynamicOperand composite = null;
            for (SelectorName name : mapping.getMappedSelectorNames()) {
                FullTextSearchScore mappedScore = new FullTextSearchScore(name);
                if (composite == null) {
                    composite = mappedScore;
                } else {
                    composite = new ArithmeticOperand(composite, ArithmeticOperator.ADD, mappedScore);
                }
View Full Code Here

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

            return comparisonBuilder(new ReferenceValue(selector(table), property));
        }

        @Override
        public ComparisonBuilder fullTextSearchScore( String table ) {
            return comparisonBuilder(new FullTextSearchScore(selector(table)));
        }
View Full Code Here

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

         * @param table the name of the table; may not be null and must refer to a valid name or alias of a table appearing in the
         *        FROM clause
         * @return the interface for completing the value portion of the criteria specification; never null
         */
        public ComparisonBuilder fullTextSearchScore( String table ) {
            return comparisonBuilder(new FullTextSearchScore(selector(table)));
        }
View Full Code Here

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

    @Test
    public void shouldParseDynamicOperandFromStringContainingFullTextSearchScoreOfSelector() {
        DynamicOperand operand = parser.parseDynamicOperand(tokens("SCORE(tableA)"), typeSystem, mock(Source.class));
        assertThat(operand, is(instanceOf(FullTextSearchScore.class)));
        FullTextSearchScore score = (FullTextSearchScore)operand;
        assertThat(score.selectorName(), is(selectorName("tableA")));
    }
View Full Code Here

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

    @Test
    public void shouldParseDynamicOperandFromStringContainingFullTextSearchScoreWithNoSelectorOnlyIfThereIsOneSelectorAsSource() {
        Source source = new NamedSelector(selectorName("tableA"));
        DynamicOperand operand = parser.parseDynamicOperand(tokens("SCORE()"), typeSystem, source);
        assertThat(operand, is(instanceOf(FullTextSearchScore.class)));
        FullTextSearchScore score = (FullTextSearchScore)operand;
        assertThat(score.selectorName(), is(selectorName("tableA")));
    }
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.