Examples of boost()


Examples of org.apache.lucene.index.IndexableField.boost()

        f = doc.getField("long_field");
        assertThat((double) f.boost(), closeTo(8.0, 0.001));

        f = doc.getField("short_field");
        assertThat((double) f.boost(), closeTo(9.0, 0.001));
    }

    @Test
    public void testInvalidFieldLevelBoost() throws Exception {
        String mapping = XContentFactory.jsonBuilder().startObject().startObject("person").startObject("properties")
View Full Code Here

Examples of org.apache.lucene.queryParser.MultiFieldQueryParserSettings.boost()

        }


        try {
            query = queryParser.parse(qpSettings.queryString());
            query.setBoost(qpSettings.boost());
            query = optimizeQuery(fixNegativeQueryIfNeeded(query));
            parseContext.indexCache().queryParserCache().put(qpSettings, query);
            return query;
        } catch (ParseException e) {
            throw new QueryParsingException(parseContext.index(), "Failed to parse query [" + qpSettings.queryString() + "]", e);
View Full Code Here

Examples of org.apache.lucene.queryParser.MultiFieldQueryParserSettings.boost()

                } else if ("phrase_slop".equals(currentFieldName) || "phraseSlop".equals(currentFieldName)) {
                    qpSettings.phraseSlop(parser.intValue());
                } else if ("fuzzy_min_sim".equals(currentFieldName) || "fuzzyMinSim".equals(currentFieldName)) {
                    qpSettings.fuzzyMinSim(parser.floatValue());
                } else if ("boost".equals(currentFieldName)) {
                    qpSettings.boost(parser.floatValue());
                } else if ("tie_breaker".equals(currentFieldName) || "tieBreaker".equals(currentFieldName)) {
                    qpSettings.tieBreaker(parser.floatValue());
                } else if ("analyze_wildcard".equals(currentFieldName) || "analyzeWildcard".equals(currentFieldName)) {
                    qpSettings.analyzeWildcard(parser.booleanValue());
                } else if ("rewrite".equals(currentFieldName)) {
View Full Code Here

Examples of org.apache.lucene.queryParser.QueryParserSettings.boost()

                    currentFieldName = parser.currentName();
                } else if (token.isValue()) {
                    if ("query".equals(currentFieldName)) {
                        qpSettings.queryString(parser.text());
                    } else if ("boost".equals(currentFieldName)) {
                        qpSettings.boost(parser.floatValue());
                    } else if ("enable_position_increments".equals(currentFieldName) || "enablePositionIncrements".equals(currentFieldName)) {
                        qpSettings.enablePositionIncrements(parser.booleanValue());
                    } else if ("allow_leading_wildcard".equals(currentFieldName) || "allowLeadingWildcard".equals(currentFieldName)) {
                        qpSettings.allowLeadingWildcard(parser.booleanValue());
                    } else if ("auto_generate_phrase_queries".equals(currentFieldName) || "autoGeneratePhraseQueries".equals(currentFieldName)) {
View Full Code Here

Examples of org.apache.lucene.queryParser.QueryParserSettings.boost()

        MapperQueryParser queryParser = parseContext.singleQueryParser(qpSettings);

        try {
            query = queryParser.parse(qpSettings.queryString());
            query.setBoost(qpSettings.boost());
            query = optimizeQuery(fixNegativeQueryIfNeeded(query));
            parseContext.indexCache().queryParserCache().put(qpSettings, query);
            return query;
        } catch (ParseException e) {
            throw new QueryParsingException(parseContext.index(), "Failed to parse query [" + qpSettings.queryString() + "]", e);
View Full Code Here

Examples of org.apache.lucene.queryparser.classic.QueryParserSettings.boost()

    public void testCaching() throws Exception {
        ResidentQueryParserCache cache = new ResidentQueryParserCache(new Index("test"), ImmutableSettings.EMPTY);
        QueryParserSettings key = new QueryParserSettings();
        key.queryString("abc");
        key.defaultField("a");
        key.boost(2.0f);

        Query query = new TermQuery(new Term("a", "abc"));
        cache.put(key, query);

        assertThat(cache.get(key), not(sameInstance(query)));
View Full Code Here

Examples of org.apache.lucene.queryparser.classic.QueryParserSettings.boost()

                } else if ("phrase_slop".equals(currentFieldName) || "phraseSlop".equals(currentFieldName)) {
                    qpSettings.phraseSlop(parser.intValue());
                } else if (FUZZINESS.match(currentFieldName, parseContext.parseFlags())) {
                    qpSettings.fuzzyMinSim(Fuzziness.parse(parser).asSimilarity());
                } else if ("boost".equals(currentFieldName)) {
                    qpSettings.boost(parser.floatValue());
                } else if ("tie_breaker".equals(currentFieldName) || "tieBreaker".equals(currentFieldName)) {
                    qpSettings.tieBreaker(parser.floatValue());
                } else if ("analyze_wildcard".equals(currentFieldName) || "analyzeWildcard".equals(currentFieldName)) {
                    qpSettings.analyzeWildcard(parser.booleanValue());
                } else if ("rewrite".equals(currentFieldName)) {
View Full Code Here

Examples of org.apache.lucene.queryparser.classic.QueryParserSettings.boost()

        try {
            query = queryParser.parse(qpSettings.queryString());
            if (query == null) {
                return null;
            }
            if (qpSettings.boost() != QueryParserSettings.DEFAULT_BOOST) {
                query.setBoost(query.getBoost() * qpSettings.boost());
            }
            query = fixNegativeQueryIfNeeded(query);
            if (query instanceof BooleanQuery) {
                Queries.applyMinimumShouldMatch((BooleanQuery) query, qpSettings.minimumShouldMatch());
View Full Code Here

Examples of org.apache.lucene.queryparser.classic.QueryParserSettings.boost()

            query = queryParser.parse(qpSettings.queryString());
            if (query == null) {
                return null;
            }
            if (qpSettings.boost() != QueryParserSettings.DEFAULT_BOOST) {
                query.setBoost(query.getBoost() * qpSettings.boost());
            }
            query = fixNegativeQueryIfNeeded(query);
            if (query instanceof BooleanQuery) {
                Queries.applyMinimumShouldMatch((BooleanQuery) query, qpSettings.minimumShouldMatch());
            }
View Full Code Here

Examples of org.elasticsearch.index.mapper.FieldMapper.boost()

            Map<String, Object> mapper = new HashMap();
            mapper.put("fullName", fieldMapper.names().fullName());
            mapper.put("indexName", fieldMapper.names().indexName());
            mapper.put("indexNameClean", fieldMapper.names().indexNameClean());

            mapper.put("boost", fieldMapper.boost());

            if (fieldMapper.indexAnalyzer() != null) {
                mapper.put("indexAnalyzer", fieldMapper.indexAnalyzer().toString());
            }
            if (fieldMapper.searchAnalyzer() != null) {
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.